Django forms always failing

I'm trying to use Django's built in authentication modules. For the site I'm working on I want to use email addresses as login names and not just the normal alphanumeric fields they're usually set to. In order to do this I changed all the String fields to Email fields and changed their max length from 30 to 320. My registration code appears to be working fine but not my login code. Here is what I'm using right now:

def login(request):
    if request.method == 'POST':
        form = AuthenticationForm(request.POST)
        if form.is_valid():
            return HttpResponse("valid")
            username = request.POST['username']
            password = request.POST['password']
            user = authenticate(username=username, password=password)
            if user is not None:
                if user.is_active:
                    login(request, user)
                    return HttpResponseRedirect("/")
                    # Redirect to a success page.
                    return HttpResponse("Disabled Account")
                    # Return a 'disabled account' error message
                return HttpResponse("Invalid Login")
                # Return an 'invalid login' error message.
            return HttpResponse("%s" % repr(form.errors))
        form = AuthenticationForm()

    return render_to_response("login.html",  {'form': form,  }, context_instance=RequestContext(request))

No matter what I submit, form.is_valid() is returning FALSE but form.errors is empty. Any ideas what might be wrong? I think I changed everything over to Email properties so I don't think that's it. Also, in case it changes anything I'm trying to do this on google app engine using djangoappengine.


Sorry, but you cannot use Django's authentication module on top of google app engine. Django uses its own special database backend which is similar to google-app-engine's but is not drop-in compatible.

If you want to do authentication on GAE, you should do it the google-app-engine way:

Need Your Help

Compiling Allegro source code

c# visual-studio-2008 allegro

I am trying to build a C# project (downloaded code) in Visual Studio Express 2008. I get the error (my translation):

WPF Setting on a Control Template

wpf wpf-controls styles controltemplate

General question. I have a ControlTemplate that is reasonably complex. Several TextBoxes etc.

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.