Opened 13 years ago
Last modified 13 years ago
#19161 closed Bug
Line missing on Dev documentation — at Version 2
| Reported by: | DavidW | Owned by: | nobody |
|---|---|---|---|
| Component: | Documentation | Version: | dev |
| Severity: | Release blocker | Keywords: | |
| Cc: | Triage Stage: | Accepted | |
| Has patch: | no | Needs documentation: | no |
| Needs tests: | no | Patch needs improvement: | no |
| Easy pickings: | yes | UI/UX: | no |
Description (last modified by )
https://docs.djangoproject.com/en/dev/topics/auth/#auth-custom-user
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 = ReadOnlyPasswordHashField()
class Meta:
model = MyUser
Needs the following added:
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"]
Or you get a not-null constraint violation on form submit.
Change History (2)
comment:1 by , 13 years ago
| Has patch: | unset |
|---|
comment:2 by , 13 years ago
| Description: | modified (diff) |
|---|
Note:
See TracTickets
for help on using tickets.
Fixed formatting (please use preview).