diff options
| author | Tim Graham <timograham@gmail.com> | 2012-11-06 19:44:49 -0500 |
|---|---|---|
| committer | Tim Graham <timograham@gmail.com> | 2012-11-06 19:44:49 -0500 |
| commit | e8f696097b19abbd3a98990ea4ca5f58d0444826 (patch) | |
| tree | 304641420bc95e1230f56d9888ece350776e8e42 | |
| parent | a386675a6a636b8e6b96277da8e9191e9dc710dc (diff) | |
Fixed #19161 - Added missing clean_password method in custom user docs
Thanks DavidW for the report.
| -rw-r--r-- | docs/topics/auth.txt | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/docs/topics/auth.txt b/docs/topics/auth.txt index f7a9084008..aed482f710 100644 --- a/docs/topics/auth.txt +++ b/docs/topics/auth.txt @@ -408,7 +408,7 @@ installation supports. The first entry in this list (that is, ``settings.PASSWORD_HASHERS[0]``) will be used to store passwords, and all the other entries are valid hashers that can be used to check existing passwords. This means that if you want to use a different algorithm, you'll need to modify -:setting:`PASSWORD_HASHERS` to list your prefered algorithm first in the list. +:setting:`PASSWORD_HASHERS` to list your preferred algorithm first in the list. The default for :setting:`PASSWORD_HASHERS` is:: @@ -2283,13 +2283,19 @@ code would be required in the app's ``admin.py`` file:: class UserChangeForm(forms.ModelForm): """A form for updateing users. Includes all the fields on the user, but replaces the password field with admin's - pasword hash display field. + password hash display field. """ password = ReadOnlyPasswordHashField() class Meta: model = MyUser + def clean_password(self): + # Regardless of what the user provides, return the initial value. + # This is done here, rather than on the field, because the + # field does not have access to the initial value + return self.initial["password"] + class MyUserAdmin(UserAdmin): # The forms to add and change user instances |
