Я хочу {% include%} 8 различных шаблонов django в 1 макете без создания нескольких макетов.
Моя цель - уменьшить общее количество файлов .html в папке моего шаблона.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
{%load static%}
<link rel="stylesheet" href="{%static 'web/css/style.css'%}">
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.8.1/css/all.css" integrity="sha384-50oBUHEmvpQ+1lW4y57PTFmhCaXp0ML5d60M1M7uH2+nqUivzIebhndOJK28anvf" crossorigin="anonymous">
</head>
<body style='margin: 0px;'>
{%include 'web/header.html'%}
{%include 'web/personal.html'%}
{%include 'web/footer.html'%}
</body>
</html>
views.py
def index(request):
template_name = 'web/index.html'
p = personal.objects.all()
return render(request,template_name)
def personal(request):
template_name = 'web/personal.html'
return render(request,template_name)
def blog(request):
template_name = 'web/blog.html'
return render(request,template_name)
Так вот мои шаблоны
web / personal.html -> немного HTML
web / blog.html -> немного HTML
.
.
.
web / n.html -> немного HTML
Я хочу, чтобы эти файлы были включены в мой файл макета динамически
Спасибо.