问题
I am extending the user model in Django and have create a PIN number field that is hashing into the database correctly.
However, in the Django admin when viewing a user the pin number field is populated with the hash. Is it possible to use the Django password widget:
so that the PIN number field is not populated:
and therefore by extension use the template for the change password form to also change the pin?
回答1:
I don't see why you couldn't use the form. Here's the Django User form: django.contrib.auth.forms.UserChangeForm that's used in the admin. The form field you want is django.contrib.auth.forms.ReadOnlyPasswordHashField
来源:https://stackoverflow.com/questions/59790374/use-django-password-widget-and-change-password-form-in-user-admin-site