mirror of
https://github.com/django/django.git
synced 2025-07-24 13:44:32 +00:00
Fixed #22539 -- Copied exclude argument in Model.full_clean() to prevent side effects.
This commit is contained in:
parent
45c2d1f5d9
commit
e2e4cdba11
3 changed files with 11 additions and 2 deletions
|
@ -59,6 +59,13 @@ class BaseModelValidationTests(ValidationTestCase):
|
|||
mtv = ModelToValidate(number=10, name='Some Name', slug='##invalid##')
|
||||
self.assertFailsValidation(mtv.full_clean, ['slug'])
|
||||
|
||||
def test_full_clean_does_not_mutate_exclude(self):
|
||||
mtv = ModelToValidate(f_with_custom_validator=42)
|
||||
exclude = ['number']
|
||||
self.assertFailsValidation(mtv.full_clean, ['name'], exclude=exclude)
|
||||
self.assertEqual(len(exclude), 1)
|
||||
self.assertEqual(exclude[0], 'number')
|
||||
|
||||
|
||||
class ArticleForm(forms.ModelForm):
|
||||
class Meta:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue