Opened 17 years ago

Closed 17 years ago

Last modified 16 years ago

#377 closed defect (wontfix)

[patch] Allow template_name argument to django.views.auth.login.login

Reported by: Adam Endicott <leftwing17@…> Owned by: Jacob
Component: Generic views Version:
Severity: normal Keywords: auth login
Cc: Triage Stage: Unreviewed
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no


Its a bit restrictive being forced to use 'registration/login' as the template when using the login generic view. So I just added a template_name keyword argument (defaults to 'registration/login') to bring it in line with some of the other generic views.

Index: django/views/auth/
--- django/views/auth/	(revision 541)
+++ django/views/auth/	(working copy)
@@ -7,7 +7,7 @@
-def login(request):
+def login(request, template_name='registration/login'):
     "Displays the login form and handles the login action."
     manipulator = AuthenticationForm(request)
     redirect_to = request.REQUEST.get(REDIRECT_FIELD_NAME, '')
@@ -23,7 +23,7 @@
         errors = {}
     response = HttpResponse()
-    t = template_loader.get_template('registration/login')
+    t = template_loader.get_template(template_name)
     c = Context(request, {
         'form': formfields.FormWrapper(manipulator, request.POST, errors),
         REDIRECT_FIELD_NAME: redirect_to,

Attachments (1) (869 bytes) - added by Adam Endicott <leftwing17@…> 17 years ago.

Download all attachments as: .zip

Change History (3)

Changed 17 years ago by Adam Endicott <leftwing17@…>

Attachment: added

comment:1 Changed 17 years ago by Jacob

Status: newassigned

comment:2 Changed 17 years ago by Adrian Holovaty

Resolution: wontfix
Status: assignedclosed

django/views/auth/ isn't a "generic" view. Generic views are in django/views/generic. The login view is a standard view.

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