How to pass my template into Django Userena signin/signup views

64 Views Asked by At

I'm using django-userena-ce in my project. After configuring settings.py, i run my app and tried to sign up, but it calls its own template with form. How can i pass my own html template? I tried this code:

    urlpatterns = [
          path('signup/', 'userena.views.signup', {'template_name': 'userena/register.html'}, name="signup"),
    ]

but it doesn't help. What i'm doing wrong?

1

There are 1 best solutions below

0
Maciej Rogosz On

You do not define any view attributes in urlpatterns. It is just URLs definitions, nothing else.

To do what you ask for, create your own view which will be inheriting from userena.views.signup, and will overwrite template_name attribute. Something like this:

from userena.views import signup

class MySignUpView(signup):
    template_name = 'userena/register.html'

Then in urls.py:

from django.urls import path
import MySignUpView

urlpatterns = [
    path('signup/', MySignUpView.as_view(), name='signup'),
]