From a4478ee9c6acf0e50fa37265e2af20b9da856ba1 Mon Sep 17 00:00:00 2001 From: Gary Wilson Jr Date: Tue, 11 Dec 2007 06:37:07 +0000 Subject: [PATCH] Fixed #6174 -- Made `AnonymousUser.is_active` False instead of True since `AnonymousUser`s can't login. Thanks, `SmileyChris`. git-svn-id: http://code.djangoproject.com/svn/django/trunk@6912 bcc190cf-cafb-0310-a4f2-bffc1f526a37 --- django/contrib/auth/models.py | 2 +- django/contrib/auth/tests.py | 12 ++++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/django/contrib/auth/models.py b/django/contrib/auth/models.py index 33f92dc854..4b1590264b 100644 --- a/django/contrib/auth/models.py +++ b/django/contrib/auth/models.py @@ -322,7 +322,7 @@ class AnonymousUser(object): id = None username = '' is_staff = False - is_active = True + is_active = False is_superuser = False _groups = EmptyManager() _user_permissions = EmptyManager() diff --git a/django/contrib/auth/tests.py b/django/contrib/auth/tests.py index 329049c546..d369ac524c 100644 --- a/django/contrib/auth/tests.py +++ b/django/contrib/auth/tests.py @@ -16,9 +16,21 @@ False >>> u2 = User.objects.create_user('testuser2', 'test2@example.com') >>> u2.has_usable_password() False + +>>> u.is_authenticated() +True +>>> u.is_staff +False +>>> u.is_active +True + >>> a = AnonymousUser() +>>> a.is_authenticated() +False >>> a.is_staff False +>>> a.is_active +False >>> a.groups.all() [] >>> a.user_permissions.all()