Opened 11 years ago

Closed 11 years ago

Last modified 11 years ago

#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 Baptiste Mispelon, 11 years ago

Easy pickings: set
Triage Stage: UnreviewedAccepted

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

comment:2 by Susan Tan, 11 years ago

Owner: changed from nobody to Susan Tan
Status: newassigned

comment:3 by Susan Tan, 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:5 by Tim Graham, 11 years ago

Summary: Improve HttpRequest.user documentationClarify 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 Chandrakant Gopalan, 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 Tim Graham <timograham@…>, 11 years ago

Resolution: fixed
Status: assignedclosed

In f407f75aae242d1bd8d4ac7f19c5d4075353c65e:

Fixed #20673 -- Clarified that HttpRequest.user uses AUTH_USER_MODEL.

Thanks littlepig for the report.

comment:8 by Tim Graham <timograham@…>, 11 years ago

In 82a6a956d50edf1008b89b886090459d2e65ac1a:

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

Thanks littlepig for the report.

Backport of f407f75aae from master.

comment:9 by Tim Graham <timograham@…>, 11 years ago

In 23748c483b128773edb5f5e8ee509bf12732595c:

[1.6.x] Fixed #20673 -- Clarified that HttpRequest.user uses AUTH_USER_MODEL.

Thanks littlepig for the report.

Backport of f407f75aae from master.

Note: See TracTickets for help on using tickets.
Back to Top