On Fri, Jun 14, 2013 at 3:29 PM, shashank sandela
<shashanksandel...@gmail.com> wrote:
> As you can see in the views.py I did import the class
> EmailOrUsernameModelBackend.

OK. But you mustn't import that class, you must allow django to import
it itself, and then django will use it when authenticating users.

You do this by specifying the class in
settings.AUTHENTICATION_BACKENDS, and then calling the function
authenticate() in your view, which you should import from
django.contrib.auth.

You are trying to call the method authenticate on your auth backend
directly. Do not do this, it is incorrect. It is because of this you
are getting the error "'User' object has no attribute 'backend'".

Please notice the difference between the **function** authenticate()
and the **method** authenticate() on your auth backend.

Your view should look like the view linked below:

https://docs.djangoproject.com/en/1.5/topics/auth/default/#how-to-log-a-user-in

Cheers

Tom

-- 
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+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to