def new_game(request): form = GameForm() if request.method == 'POST': form = GameForm(request.POST) if form.is_valid(): g = Game() g.acronym = form.get_acronym() g.max_players = int(form.cleaned_data['max_players']) g.minutes_per_round = int(form.cleaned_data['minutes_per_round']) g.save() g.add_player(request.user) return redirect('game.views.game', g.pk) return render(request, 'new_game.html', form=form)