In the ModelForm documentation (https://docs.djangoproject.com/en/dev/
topics/forms/modelforms/) the following snippet appears:

# Create a form to edit an existing Article.
>>> a = Article.objects.get(pk=1)
>>> f = ArticleForm(instance=a)
>>> f.save()

I may be doing something wrong, but I can't see how that should work
in Django's current codebase.

The save() method eventually calls save_m2m(), and at forms/models.py:
77 Django tries to get at f.cleaned_data - which doesn't exist,
because the form hasn't been validated yet.

Even if the form had been validated, the validation would have failed,
because Django thinks this is an unbound form. I don't know whether
that's correct or not - it's been bound to an initial instance if not
to new data.

Either way, I can't see what the snippet above is trying to tell me.
Can someone help me?

Thanks,
Toby

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to