Opened 8 years ago

Closed 7 years ago

Last modified 6 years ago

#24126 closed Cleanup/optimization (fixed)

Consider deprecating the current_app argument of auth views

Reported by: Aymeric Augustin Owned by: lukawoj
Component: contrib.auth Version: dev
Severity: Normal Keywords: current_app
Cc: Triage Stage: Accepted
Has patch: yes Needs documentation: yes
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no


All views defined in django.contrib.auth.views have the following structure:

def view(request, ..., current_app=None, ...):


    if current_app is not None:
        request.current_app = current_app

    return TemplateResponse(request, template_name, context)

As of Django 1.8 current_app is set on the request object. (This is debated but no other concrete proposal has been made at this time.)

For consistency the auth views should require the caller to set it on the request instead of passing it in a separate argument.

That would also avoid the risk of conflicts between a current_app set on the request and another current_app passed in argument. Currently the latter overrides the former.

Change History (8)

comment:1 Changed 8 years ago by Tim Graham

Triage Stage: UnreviewedAccepted

I guess the use case of making it a view parameter is that maybe you want to be able to simply use these views in a URLconf and specify the current_app that way? Further investigation is likely required.

comment:2 Changed 8 years ago by Aymeric Augustin

Keywords: current_app added; multiple-template-engines removed

comment:3 Changed 7 years ago by lukawoj

Owner: changed from nobody to lukawoj
Status: newassigned

comment:4 Changed 7 years ago by lukawoj

Has patch: set

comment:5 Changed 7 years ago by Tim Graham

Needs documentation: set

comment:6 Changed 7 years ago by Tim Graham

It looks like the use case for adding current_app was for the admin: cc64fb5c4b4315a4ad66e21458e27ece57266847.

If we automatically set the current_app as suggested in #24127, that would allow us to proceed with this deprecation without having to add request.current_app = request.resolver_match.namespace in all the admin callers in contrib/admin/

comment:7 Changed 7 years ago by Tim Graham <timograham@…>

Resolution: fixed
Status: assignedclosed

In 927b30a:

Fixed #24126 -- Deprecated current_app parameter to auth views.

comment:8 Changed 6 years ago by Tim Graham <timograham@…>

In 9f9a3d64:

Refs #24126 -- Removed auth views' current_app parameter per deprecation timeline.

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