就这个passwordinput特殊,需要价格render_value=True的参数,就会在表单提交错误时,重新渲染模板后会保留密码
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