[Fixed]-Django: class based views login


You shouldn’t use ModelForm class for your login form’s base class because in this case when you call form.is_valid() in your view it’s not only validates email and code form fields, but also checks if you can create a new instance of APPLICANT_DATA with email and code that were submitted. As a result your form instance is invalid, that’s why you see message “user already exists”

And in your case you only need to validate email and code field, so you should just use forms.Form class as a parent class to you loginform.


Leave a comment