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()