mirror of
https://github.com/django/django.git
synced 2025-08-04 02:48:35 +00:00
Fixed #33346 -- Fixed SimpleTestCase.assertFormsetError() crash on a formset named "form".
Thanks OutOfFocus4 for the report.
Regression in 456466d932
.
This commit is contained in:
parent
8a4e506760
commit
cb383753c0
3 changed files with 14 additions and 2 deletions
|
@ -1512,6 +1512,16 @@ class AssertFormsetErrorTests(SimpleTestCase):
|
|||
])
|
||||
self.assertFormsetError(response, 'formset', None, None, 'error')
|
||||
|
||||
def test_formset_named_form(self):
|
||||
formset = TestFormset.invalid()
|
||||
# The mocked context emulates the template-based rendering of the
|
||||
# formset.
|
||||
response = mock.Mock(context=[
|
||||
{'form': formset},
|
||||
{'form': formset.management_form},
|
||||
])
|
||||
self.assertFormsetError(response, 'form', 0, 'field', 'invalid value')
|
||||
|
||||
|
||||
class FirstUrls:
|
||||
urlpatterns = [path('first/', empty_response, name='first')]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue