Django form.is_valid() always false

It turns out that Maxime was right after all (sorry) - you do need the data parameter:

form = AuthenticationForm(data=request.POST)

The reason for that, though, is that AuthenticationForm overwrites the signature of __init__ to expect the request as the first positional parameter. If you explicitly supply data as a kwarg, it will work.

(You should still leave out the else clause that redirects away on error, though: it's best practice to let the form re-render itself with errors in that case.)


Check out form.errors which will help you find out why.