0
我有以下形式:形式不允許編輯
class PlayForwardPageForm(forms.ModelForm):
def __init__(self, *args, **kwargs):
super(PlayForwardPageForm, self).__init__(*args, **kwargs)
class Meta:
model = PlayForwardPage
exclude = ('id',)
def save(self, *args, **kwargs):
post = super(PlayForwardPageForm, self).save(*args, **kwargs)
post.save()
和視圖,顯示它:
object = PlayForwardPage.objects.all()[0]
form = PlayForwardPageForm(instance=object)
if request.method == "POST":
form = PlayForwardPage(data=request.POST, instance=object)
if form.is_valid():
form.save()
return HttpResponseRedirect(reverse('manage_playforward',))
else:
form = PlayForwardPageForm(instance=object)
當加載網頁一切正常。但是,當我試圖保存更改的數據形式獲得:
'data' is an invalid keyword argument for this function
有人能看到任何理由,這種行爲?