Forums

Django login from header?

I have a generic login form that works perfectly using the login module from django.contrib.auth.views

What I am trying to do is have a login dropdown that is visible from the website header (which is included on all pages) if the user is not authenticated. I have the dropdown working correctly if the user is not authenticated, but after filling out the username/password, nothing happens.

For code example and more detail please see my stackoverflow post: http://stackoverflow.com/questions/19468671/django-login-form-in-header

Anyone have suggestions/solutions for accomplishing this type of login? Let me know of any information/code that will help solve this.

Three's really not enough information here or in the StackOverflow post for us to have any chance of giving you specific help. As for generic help, though, there are 2 places that the login could be failing: * The HTML doesn't actually send the form data to your view * the view doesn't handle the form data the way you think it does

Thanks Glenn, that helped me clarify and solve the problem.

I had narrowed it down to a problem passing the HTML since the login works correctly on the /accounts/login/ page. I found out that the logging in from the header worked only on the /accounts/login/, but the other pages it did not, so that meant there definitely was a problem passing to the page.

The problem ended up being that I had the property named "action", when it should have been "formaction". I knew it was really close and it would be something dumb like that :-)

Thanks!