GotaKev
GotaKev

Reputation: 45

Templates hmtl in view

I work under Django-python for the development of an application. For a few hours I have been stuck on the integration of html pages, let me explain: I can't associate several HTML pages under the same python class...

class DieeCreateView(DieeBaseView, FormView):
    """View to create a Diee"""

    form_class = DieeForm
    template_name = 'diee_create.html'

So I modified urls.py

urlpatterns = [
    path(
        "diee/new",
        diee_view.DieeCreateView.as_view(),
        name="diee_create",
    ),
    path(
        "diee/new/newthree",
        diee_view.DieeCreateView.as_view(),
        name="diee_create_03",
    ),]

then make a list

class DieeCreateView(DieeBaseView, FormView):
    """View to create a Diee"""

    form_class = DieeForm
    template_name = ['diee_create.html', 'diee_create_03.html'] 

but nothing works...

Thanks in advance

Upvotes: 1

Views: 43

Answers (1)

user20223018
user20223018

Reputation: 833

I believe you can change this in your urls.py like the following:

urls.py

urlpatterns = [
    path("your_url", views.DieeCreateView.as_view(template_name="your_template_name.html")),
    path("your_other_url", views.DieeCreateView.as_view(template_name="your_other_template.html"))
]

Upvotes: 1

Related Questions