diff --git a/django/contrib/admin/sites.py b/django/contrib/admin/sites.py index 68621e333e..10b82af0a4 100644 --- a/django/contrib/admin/sites.py +++ b/django/contrib/admin/sites.py @@ -139,7 +139,7 @@ class AdminSite(object): Returns True if the given HttpRequest has permission to view *at least one* page in the admin site. """ - return request.user.is_authenticated() and request.user.is_staff + return request.user.is_staff def check_dependencies(self): """ diff --git a/django/contrib/admin/templates/admin/base.html b/django/contrib/admin/templates/admin/base.html index 95257285eb..a9d281641a 100644 --- a/django/contrib/admin/templates/admin/base.html +++ b/django/contrib/admin/templates/admin/base.html @@ -22,7 +22,7 @@
{% block branding %}{% endblock %}
- {% if user.is_authenticated and user.is_staff %} + {% if user.is_staff %}
{% trans 'Welcome,' %} {% firstof user.first_name user.username %}. diff --git a/django/contrib/admin/views/decorators.py b/django/contrib/admin/views/decorators.py index 4566828b0a..d28186e4e7 100644 --- a/django/contrib/admin/views/decorators.py +++ b/django/contrib/admin/views/decorators.py @@ -28,7 +28,7 @@ def staff_member_required(view_func): member, displaying the login page if necessary. """ def _checklogin(request, *args, **kwargs): - if request.user.is_authenticated() and request.user.is_staff: + if request.user.is_staff: # The user is valid. Continue to the admin page. return view_func(request, *args, **kwargs) diff --git a/django/middleware/doc.py b/django/middleware/doc.py index 48c155c392..2b4e6827f8 100644 --- a/django/middleware/doc.py +++ b/django/middleware/doc.py @@ -12,7 +12,7 @@ class XViewMiddleware(object): indicating the view function. This is used by the documentation module to lookup the view function for an arbitrary page. """ - if request.method == 'HEAD' and (request.META.get('REMOTE_ADDR') in settings.INTERNAL_IPS or (request.user.is_authenticated() and request.user.is_staff)): + if request.method == 'HEAD' and (request.META.get('REMOTE_ADDR') in settings.INTERNAL_IPS or request.user.is_staff): response = http.HttpResponse() response['X-View'] = "%s.%s" % (view_func.__module__, view_func.__name__) return response diff --git a/docs/topics/auth.txt b/docs/topics/auth.txt index 9874135b02..6b120eac38 100644 --- a/docs/topics/auth.txt +++ b/docs/topics/auth.txt @@ -1031,7 +1031,7 @@ checks to make sure the user is logged in and has the permission ``polls.can_vote``:: def my_view(request): - if not (request.user.is_authenticated() and request.user.has_perm('polls.can_vote')): + if not request.user.has_perm('polls.can_vote'): return HttpResponse("You can't vote in this poll.") # ...