On Thu, Jul 9, 2009 at 4:44 PM, TechnicalBard <rodwe...@gmail.com> wrote:

>
> Have discovered what works - but it goes against the docs...
>
> I needed to set User.is_active = True.  The permissions for admin
> (has_perm) appears to check this flag and returns False for inactive
> users.
>
> Problem solved.
>

What docs does this go against?  I don't see how what you have found goes
against the general auth doc:

http://docs.djangoproject.com/en/dev/topics/auth/#django.contrib.auth.models.User.is_active

Logging in to admin is not mentioned there.  This is the documentation for
django.contrib.auth, which is independent of the admin app (though admin is
an app that uses services of auth).

It is mentioned that if, for your app, you want to disable login for users
with is_active = False, then you need to do that in your own login view.
Admin happens to be an app that has done that.  Admin actually goes further
and only allows login for users who have both is_active and is_staff set to
True:

http://code.djangoproject.com/browser/django/tags/releases/1.0.2/django/contrib/admin/sites.py#L260

This behavior is also mentioned in the FAQ:

http://docs.djangoproject.com/en/dev/faq/admin/#i-can-t-log-in-when-i-enter-a-valid-username-and-password-it-brings-up-the-login-page-again-with-a-please-enter-a-correct-username-and-password-error

Karen

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to