Django form not calling clean_

后端 未结 2 1905
我寻月下人不归
我寻月下人不归 2021-02-06 02:59

I am attempting to validate a form (and it used to work before). For some reason, I can\'t seem to get the various cleaning functions such as clean_username(self) to get called

2条回答
  •  野的像风
    2021-02-06 03:22

    You can override this by using required=False in your field constructors.

    username = forms.CharField(max_length=30, required=False)
    password = forms.CharField(max_length=30,widget=forms.PasswordInput, required=False)
    

    This seems illogical for your example, but can be useful if other instances

提交回复
热议问题