F
F
fantom_ask2020-08-06 09:09:20
Django
fantom_ask, 2020-08-06 09:09:20

How can I make a template hierarchy?

in the view.py file I call a file with a template, for example page.html, and already through page.html I connect to the parent template {% extends 'base.html' %} But I don't understand how I can load page.html from another html file, for example header.html

This is necessary so as not to write the header several times, because if I need, for example
, page1.htm to connect header1.html, footer1.html
page2.htm to connect header2.html, footer1.html
page3.htm to connect header1.html, footer2 .html
the only thing I can do is
page1.htm include base1.html
page2.htm include base2.html
page3.htm include base3.html
which is a bunch of extra code

I just started learning django. so can someone explain this to me

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dr. Bacon, 2020-08-06
@fantom_ask

Finally read the docs , everything is there https://docs.djangoproject.com/en/3.1/ref/template...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question