mirror of
https://github.com/django/django.git
synced 2025-10-24 06:06:09 +00:00
Fixed #5524 -- Do not remove cleaned_data when a form fails validation
cleaned_data is no longer deleted when form validation fails but only contains the data that did validate. Thanks to the various contributors to this patch (see ticket).
This commit is contained in:
@@ -638,8 +638,7 @@ class OldFormForXTests(TestCase):
|
||||
f = BaseCategoryForm({'name': '', 'slug': 'not a slug!', 'url': 'foo'})
|
||||
self.assertEqual(f.errors['name'], ['This field is required.'])
|
||||
self.assertEqual(f.errors['slug'], ["Enter a valid 'slug' consisting of letters, numbers, underscores or hyphens."])
|
||||
with self.assertRaises(AttributeError):
|
||||
f.cleaned_data
|
||||
self.assertEqual(f.cleaned_data, {'url': 'foo'})
|
||||
with self.assertRaises(ValueError):
|
||||
f.save()
|
||||
f = BaseCategoryForm({'name': '', 'slug': '', 'url': 'foo'})
|
||||
|
||||
Reference in New Issue
Block a user