#20673 closed Cleanup/optimization (fixed)
Clarify that HttpRequest.user uses AUTH_USER_MODEL
Reported by: | Jorge C. Leitão | Owned by: | Susan Tan |
---|---|---|---|
Component: | Documentation | Version: | 1.5 |
Severity: | Normal | Keywords: | |
Cc: | Jorge C. Leitão | Triage Stage: | Accepted |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | yes | UI/UX: | no |
Description
In https://docs.djangoproject.com/en/dev/ref/request-response/#django.http.HttpRequest.user it is said
A django.contrib.auth.models.User object representing the currently logged-in user.
But apparently (http://stackoverflow.com/questions/17355275), it returns the AUTH_USER_MODEL if it is defined.
I think this should be clarified in the documentation.
Change History (9)
comment:1 by , 11 years ago
Easy pickings: | set |
---|---|
Triage Stage: | Unreviewed → Accepted |
comment:2 by , 11 years ago
Owner: | changed from | to
---|---|
Status: | new → assigned |
comment:3 by , 11 years ago
To be honest, I'm not entirely sure what the docstring needs to be in "contrib.auth.backends.ModelBackend". Can someone point me in the right direction?
comment:4 by , 11 years ago
Feel free to check this 1-line change: https://github.com/onceuponatimeforever/django/commit/177f0400c46d27463316c962780ea4b351077aeb
comment:5 by , 11 years ago
Summary: | Improve HttpRequest.user documentation → Clarify that HttpRequest.user uses AUTH_USER_MODEL |
---|
Susan, the problem is that the docs say that a django.contrib.auth.models.User
object is returned, but with the introduction of custom user models, that may no longer be true.
comment:6 by , 11 years ago
Let me take a shot...
Instead of:
A
django.contrib.auth.models.User
object representing the currently
logged-in user.
Say this:
An object representing the currently logged-in user. Will be the user object in
:setting:AUTH_USER_MODEL
setting if specified,django.contrib.auth.models.User
otherwise.
comment:7 by , 11 years ago
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
Good catch, thanks.
It looks like the docstring for
contrib.auth.backends.ModelBackend
[1] is incorrect too.[1] https://github.com/django/django/blob/master/django/contrib/auth/backends.py#L8