[patch] Allow template_name argument to django.views.auth.login.login
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,
django/views/auth/login.py
isn't a "generic" view. Generic views are indjango/views/generic
. The login view is a standard view.