Is there a way to pre-populate a Django form password field so that it display something in the resulting <input type="password">
html element?
The default behavior seems to be not to display anything when the MyForm(initial = {'passfield':'something'})
is set.
I need this in order to implement an user edit form. I want to display a random string which if the user doesn't modify I will know that he does not want to change the password. So I don't think there is ANY security issue in what I'm trying to do.
It seems that using the render_value argument works not just for the case listed in the Django docs and can be used:
class MyForm(forms.Form):
password_field = forms.CharField(widget = forms.PasswordInput(render_value = True))
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With