Django 1.6 login fix (#522)