Fixed #11404. Added `FormSet.has_changed, for consistancy with Form.has_changed`. Thanks to michelts for the patch.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@16773 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Alex Gaynor 2011-09-10 02:42:05 +00:00
parent 01b0eb50fd
commit d14bf8c62b
3 changed files with 48 additions and 1 deletions

View file

@ -150,6 +150,20 @@ As we can see, ``formset.errors`` is a list whose entries correspond to the
forms in the formset. Validation was performed for each of the two forms, and
the expected error message appears for the second item.
We can also check if form data differs from the initial data (i.e. the form was
sent without any data)::
>>> data = {
... 'form-TOTAL_FORMS': u'1',
... 'form-INITIAL_FORMS': u'0',
... 'form-MAX_NUM_FORMS': u'',
... 'form-0-title': u'',
... 'form-0-pub_date': u'',
... }
>>> formset = ArticleFormSet(data)
>>> formset.has_changed()
False
.. _understanding-the-managementform:
Understanding the ManagementForm