Django retains password when submitting form password error

This password input is special and requires the parameter render_value=True. When the form submission error occurs, the password will be retained after the template is re-rendered. 

    password = forms.CharField(label='密码', max_length=100,
                               widget=forms.PasswordInput(render_value=True, attrs={'placeholder': '密码(最短6位)'}))

https://docs.djangoproject.com/en/2.2/ref/forms/widgets/#passwordinput

https://stackoverflow.com/a/33839975

Guess you like

Origin blog.csdn.net/u011519550/article/details/113764309