Issue
I am using django-registration standard urlpatterns, but i want to rename its template name. By default it is "registration/login.html". In source code there is a parameter "template_name" that i want to change:
class LoginView(RedirectURLMixin, FormView):
"""
Display the login form and handle the login action.
"""
form_class = AuthenticationForm
authentication_form = None
template_name = "registration/login.html"
redirect_authenticated_user = False
extra_context = None
How and where i can do it? (p.s. django.contrib.auth.views.LoginView.template_name = name is not working, or i just write it in incorrect place)
Solution
You can change it in urls.py:
urlpatterns = [
...
path('login/', auth.LoginView.as_view(template_name="new_name_login.html"), ...)
]
or you can create your own view (views.py) that is inheriting from the default one:
class MyLoginView(LoginView):
template_name="new_name_login.html"
...
Answered By - NixonSparrow
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.