Wednesday, November 29, 2017

Re: Why does Django say my login form is invalid? How can I find out why Django thinks it is?

What would I need to change? 

I tried changing the ...
fields= ("username",)

... to ...
fields= ("username","email",)
or...
fields= ("email",)

Nothing seemed to change. the `login_form.is_valid()` still is `False`.

Sorry if the question is dumb, I'm still learning Django thru working with it.



On Wednesday, November 29, 2017 at 12:21:04 AM UTC-5, Matemática A3K wrote:

class LoginForm(AuthenticationForm):
 username
= forms.EmailField(label=_("Email"), max_length=254)


 
class Meta:
 model
= User
 

 fields
= ("username",)


If you use "fields = ("username")" you are restricting the fields to just that field, and the authentication form needs also password to be valid
 

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.
To post to this group, send email to django...@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/1e861f42-2115-4377-848c-67c59d122610%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/7dafbe54-6563-401b-9461-b857f9340d64%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment