1
0
mirror of https://github.com/django/django.git synced 2025-10-24 14:16:09 +00:00

[1.1.x] Fixed #12878. Formset-wide errors are now rendered properly as html. Backport of r12548 from trunk.

git-svn-id: http://code.djangoproject.com/svn/django/branches/releases/1.1.X@12549 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Joseph Kocherhans
2010-02-23 21:09:27 +00:00
parent a1bff5f823
commit 860497c9b3
3 changed files with 34 additions and 1 deletions

View File

@@ -598,4 +598,20 @@ Make sure the management form has the correct prefix.
>>> formset.management_form.prefix
'form'
# Regression test for #12878 #################################################
>>> data = {
... 'drinks-TOTAL_FORMS': '2', # the number of forms rendered
... 'drinks-INITIAL_FORMS': '0', # the number of forms with initial data
... 'drinks-MAX_NUM_FORMS': '0', # max number of forms
... 'drinks-0-name': 'Gin and Tonic',
... 'drinks-1-name': 'Gin and Tonic',
... }
>>> formset = FavoriteDrinksFormSet(data, prefix='drinks')
>>> formset.is_valid()
False
>>> print formset.non_form_errors()
<ul class="errorlist"><li>You may only specify a drink once.</li></ul>
"""