diff options
| author | Tim Graham <timograham@gmail.com> | 2013-07-04 09:32:32 -0400 |
|---|---|---|
| committer | Tim Graham <timograham@gmail.com> | 2013-07-04 09:33:40 -0400 |
| commit | 82a6a956d50edf1008b89b886090459d2e65ac1a (patch) | |
| tree | 24fe64c804c933ca5c9b1d7689b32878fe0a00ca | |
| parent | fa37f45c32c8fa7c6909b72e94b9d90e6efe7ed9 (diff) | |
[1.5.x] Fixed #20673 -- Clarified that HttpRequest.user uses AUTH_USER_MODEL.
Thanks littlepig for the report.
Backport of f407f75aae from master.
| -rw-r--r-- | django/contrib/auth/backends.py | 2 | ||||
| -rw-r--r-- | docs/ref/request-response.txt | 11 |
2 files changed, 7 insertions, 6 deletions
diff --git a/django/contrib/auth/backends.py b/django/contrib/auth/backends.py index 05e9bfd721..6b31f72b03 100644 --- a/django/contrib/auth/backends.py +++ b/django/contrib/auth/backends.py @@ -5,7 +5,7 @@ from django.contrib.auth.models import Permission class ModelBackend(object): """ - Authenticates against django.contrib.auth.models.User. + Authenticates against settings.AUTH_USER_MODEL. """ def authenticate(self, username=None, password=None, **kwargs): diff --git a/docs/ref/request-response.txt b/docs/ref/request-response.txt index c7f4ddd8ae..26681e575e 100644 --- a/docs/ref/request-response.txt +++ b/docs/ref/request-response.txt @@ -169,10 +169,11 @@ 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. @@ -180,8 +181,8 @@ All attributes should be considered read-only, unless stated otherwise below. # Do something for anonymous users. ``user`` is only available if your Django installation has the - ``AuthenticationMiddleware`` activated. For more, see - :doc:`/topics/auth/index`. + :class:`~django.contrib.auth.middleware.AuthenticationMiddleware` + activated. For more, see :doc:`/topics/auth/index`. .. attribute:: HttpRequest.session |
