Django

Code

Ticket #377 (closed: wontfix)

Opened 5 years ago

Last modified 3 years ago

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

Reported by: Adam Endicott <leftwing17@gmail.com> Assigned to: jacob
Milestone: Component: Generic views
Version: Keywords: auth login
Cc: Triage Stage: Unreviewed
Has patch: 1 Needs documentation: 0
Needs tests: 0 Patch needs improvement: 0

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

login.py.diff (0.8 kB) - added by Adam Endicott <leftwing17@gmail.com> on 08/20/05 18:33:40.

Change History

08/20/05 18:33:40 changed by Adam Endicott <leftwing17@gmail.com>

  • attachment login.py.diff added.

08/22/05 09:44:54 changed by jacob

  • status changed from new to assigned.

08/31/05 11:50:53 changed by adrian

  • status changed from assigned to closed.
  • resolution set to wontfix.

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/Change #377 ([patch] Allow template_name argument to django.views.auth.login.login)




Change Properties
Action