Code

Opened 9 years ago

Closed 9 years ago

Last modified 7 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: UI/UX:

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@…> 9 years ago.

Download all attachments as: .zip

Change History (3)

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

comment:1 Changed 9 years ago by jacob

  • Status changed from new to assigned

comment:2 Changed 9 years ago by adrian

  • Resolution set to wontfix
  • Status changed from assigned to closed

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

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.