Answer the question
In order to leave comments, you need to log in
Is it possible to extend multiple templates in Django?
Hello.
I had an idea to split site elements into templates. For example, an authorization string, a footer, a side slider, etc. All this should be written into separate templates and the necessary page should inherit the necessary templates. But in the end, djanga gives an error that only one template can be extended.
The site has a lot of different pages, so making one common template and somehow running around with a tambourine around it alone is not ok. And if you already use several templates of ready-made pages, and not elements, then copy-paste of elements begins.
Answer the question
In order to leave comments, you need to log in
If a piece of layout is used more than once, select it in a block and include where necessary.
Make several overkill root templates, this should be done only when your template inheritance goes three or more levels
deep Then you should collapse them to several special root templates
If
do not change from template to template, then they should be left in the root template
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question