I have a following form:
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()
and view that shows it :
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)
When loading page everything works fine. But when I try to save the form with changed data I get:
'data' is an invalid keyword argument for this function
Can anyone see any reason or this behavior ?