def game_edit(request, game_id): if request.method == 'POST': Game.update(game_id, title=request.POST['game_title'], genre_id=request.POST['genre_id'], ) return redirect('games:index') else: # request.method == 'GET' context = {'game': Game.select(game_id), 'genres': Genre.select_all()} return render(request, 'games/edit.html', context)