I am currently doing the following and was wondering if there's any way to condense these 4 lines...as they'r开发者_开发技巧e very verbose....
g = game_form.save(commit=False)
team = Team.objects.get(pk=team_id)
g.team = team
g.save()
If it's ok for Team
to be part of the form then I would make Team
a ModelChoiceField in my form. Django will handle everything behind the scenes for you.
精彩评论