W
W
WebDeveloper20162016-11-14 08:48:54
Django
WebDeveloper2016, 2016-11-14 08:48:54

How to make a master page?

How to make a master page? Those. a page that will serve as a container for all views in the project. (declare a header, footer, etc. there) As far as I know, you can use the include tag for partial view, but I don’t quite understand how to render the desired view ... For example:
master.html

<header></header>
<div class="content">
{% include "index.html" %}
</div>
<footer></footer>

Those. gets something somewhere in the view:
def index(request):
  render(request, 'master.html');

And then what? If multiple views? Yes, and the parameters will have to be duplicated in python and html code ...
In general, how is this done correctly?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vlad, 2016-11-14
@d1skort

https://tutorial.djangogirls.org/en/template_extending/

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question