0
請考慮我在下面覆蓋的FormView。成功創建新的聯盟記錄後,我如何參考該記錄以便我可以將用戶重定向到該聯盟特定的更一般的編輯頁面?如何使用FormView引用新創建的對象
class LeagueView(FormView):
template_name = 'leagueapp/addleague.html'
form_class = LeagueForm
def form_valid():
newleague = ??? #newly created league
success_url = '/league/editleague/' + str(newleague.id)
return HttpResponseRedirect(self.get_success_url())