Opened 19 years ago

Closed 19 years ago

Last modified 18 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

Description

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/login.py
===================================================================
--- django/views/auth/login.py	(revision 541)
+++ django/views/auth/login.py	(working copy)
@@ -7,7 +7,7 @@
 
 REDIRECT_FIELD_NAME = 'next'
 
-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()
     request.session.set_test_cookie()
-    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)

login.py.diff (869 bytes ) - added by Adam Endicott <leftwing17@…> 19 years ago.

Download all attachments as: .zip

Change History (3)

by Adam Endicott <leftwing17@…>, 19 years ago

Attachment: login.py.diff added

comment:1 by Jacob, 19 years ago

Status: newassigned

comment:2 by Adrian Holovaty, 19 years ago

Resolution: wontfix
Status: assignedclosed

django/views/auth/login.py 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