Wednesday, November 29, 2017

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

I removed that line, but nothing changed.

On Wednesday, November 29, 2017 at 11:58:28 PM UTC-5, Matemática A3K wrote:


On Thu, Nov 30, 2017 at 12:35 AM, Tom Tanner <dontsende...@gmail.com> wrote:
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.


Try not using fields at all, that will use the fields in AuthenticationForm
 


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...@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/7dafbe54-6563-401b-9461-b857f9340d64%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/c506fa03-09f7-4f69-b464-ec2d789baf65%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment