AdminPasswordChangeForm
A form used to change the password of a user in the admin interface.
Attributes
| Attribute | Type | Description |
|---|---|---|
| required_css_class | string = "required" | The CSS class applied to the HTML elements of required form fields, defaulting to "required". |
| usable_password_help_text | string | Help text displayed to administrators explaining that disabling the usable password will result in the loss of the user's current password. |
Constructor
Signature
def AdminPasswordChangeForm(
user: User object,
*args: tuple,
**kwargs: dict
) - > null
Parameters
| Name | Type | Description |
|---|---|---|
| user | User object | The user instance whose password is being changed. |
| *args | tuple | Variable length argument list. |
| **kwargs | dict | Arbitrary keyword arguments. |
Methods
clean()
@classmethod
def clean() - > dict
Validates the provided passwords against general security rules and user-specific constraints before returning the cleaned data.
Returns
| Type | Description |
|---|---|
dict | A dictionary of validated form input values. |
save()
@classmethod
def save(
commit: boolean = True
) - > [User](../models/user.md?sid=django_contrib_auth_models_user)
Save the new password.
Parameters
| Name | Type | Description |
|---|---|---|
| commit | boolean = True | Determines whether the password change should be persisted to the database immediately. |
Returns
| Type | Description |
|---|---|
[User](../models/user.md?sid=django_contrib_auth_models_user) | The user object with the updated password applied. |
changed_data()
@classmethod
def changed_data() - > list
Identifies if the password fields have been modified, returning a simplified list of changed field names.
Returns
| Type | Description |
|---|---|
list | A list containing the string 'password' if any password-related fields were modified, otherwise an empty list. |