Browse files

[1.5.x] Fixed #20673 -- Clarified that HttpRequest.user uses AUTH_USE…


Thanks littlepig for the report.

Backport of f407f75 from master.
  • Loading branch information...
timgraham committed Jul 4, 2013
1 parent fa37f45 commit 82a6a956d50edf1008b89b886090459d2e65ac1a
Showing with 7 additions and 6 deletions.
  1. +1 −1 django/contrib/auth/
  2. +6 −5 docs/ref/request-response.txt
@@ -5,7 +5,7 @@
class ModelBackend(object):
Authenticates against django.contrib.auth.models.User.
Authenticates against settings.AUTH_USER_MODEL.
def authenticate(self, username=None, password=None, **kwargs):
@@ -169,19 +169,20 @@ All attributes should be considered read-only, unless stated otherwise below.
.. attribute:: HttpRequest.user
A ``django.contrib.auth.models.User`` object representing the currently
An object of type :setting:`AUTH_USER_MODEL` representing the currently
logged-in user. If the user isn't currently logged in, ``user`` will be set
to an instance of ``django.contrib.auth.models.AnonymousUser``. You
can tell them apart with ``is_authenticated()``, like so::
to an instance of :class:`django.contrib.auth.models.AnonymousUser`. You
can tell them apart with
:meth:`~django.contrib.auth.models.User.is_authenticated`, like so::
if request.user.is_authenticated():
# Do something for logged-in users.
# Do something for anonymous users.
``user`` is only available if your Django installation has the
``AuthenticationMiddleware`` activated. For more, see
activated. For more, see :doc:`/topics/auth/index`.
.. attribute:: HttpRequest.session

0 comments on commit 82a6a95

Please sign in to comment.