summaryrefslogtreecommitdiff
path: root/tests/auth_tests/test_forms.py
diff options
context:
space:
mode:
authorMalte Gerth <malte.gerth@proclima.de>2018-03-29 11:35:53 +0200
committerTim Graham <timograham@gmail.com>2018-03-29 15:25:54 -0400
commit874977d388decdd59022bf6b7f4d50caf2052155 (patch)
treedb63ffd0845953f31ee2f0859482b949464264b0 /tests/auth_tests/test_forms.py
parentc59aa9e6aa0b90bc8d4f8e9be0079c3c5b901879 (diff)
Fixed #29270 -- Fixed UserChangeForm crash if password field is excluded.
Diffstat (limited to 'tests/auth_tests/test_forms.py')
-rw-r--r--tests/auth_tests/test_forms.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/tests/auth_tests/test_forms.py b/tests/auth_tests/test_forms.py
index b1d55c9749..32b2173996 100644
--- a/tests/auth_tests/test_forms.py
+++ b/tests/auth_tests/test_forms.py
@@ -797,6 +797,17 @@ class UserChangeFormTest(ReloadFormsMixin, TestDataMixin, TestCase):
form = UserChangeForm(data, instance=user)
self.assertTrue(form.is_valid())
+ def test_password_excluded(self):
+ class UserChangeFormWithoutPassword(UserChangeForm):
+ password = None
+
+ class Meta:
+ model = User
+ exclude = ['password']
+
+ form = UserChangeFormWithoutPassword()
+ self.assertNotIn('password', form.fields)
+
@override_settings(TEMPLATES=AUTH_TEMPLATES)
class PasswordResetFormTest(TestDataMixin, TestCase):