I have a ModelForm for the User model that I want to use to allow the user to update some of their settings (first name, last name, email, and, of course, password). It's a very basic form and I did the UserForm(instance=user)
so the user would see their current values. However, it's populating the password field, which seems kind of crazy (especially since it's the hashed value - not that I want their actual value to be shown). I would prefer the password is just left empty (I've added an extra field to the model form so they must enter their new password twice).
Is there a way to specify that this field should not be populated? It also seems to be defaulting to type='text'
(looking at the html source) instead of type='password'
.
Thanks
Django
ModelForm
havewidgets
attribute and also you can use forms widgets PasswordInput for password fieldlet's assume you already have working view..so I skip the full view here
set the widgets like
And using the init to define the initial value