Пример #1
0
def new_installer(request, slug):
    game = get_object_or_404(models.Game, slug=slug)
    installer = Installer(game=game)
    installer.set_default_installer()
    form = InstallerForm(request.POST or None, instance=installer)
    if request.method == "POST" and form.is_valid():
        installer = form.save(commit=False)
        installer.game_id = game.id
        installer.user = request.user
        installer.save()
        notify_installer(installer)
        return redirect("installer_complete", slug=game.slug)
    return render(
        request, "installers/form.html", {"form": form, "game": game, "new": True}
    )
Пример #2
0
def new_installer(request, slug):
    game = get_object_or_404(models.Game, slug=slug)
    installer = Installer(game=game)
    installer.set_default_installer()
    form = InstallerForm(request.POST or None, instance=installer)
    if request.method == "POST" and form.is_valid():
        installer = form.save(commit=False)
        installer.game_id = game.id
        installer.user = request.user
        installer.save()
        notify_installer(installer)
        return redirect("installer_complete", slug=game.slug)
    return render(
        request, "installers/form.html", {"form": form, "game": game, "new": True}
    )