Answer the question
In order to leave comments, you need to log in
Django templates or how to understand them?
Good day!
I'm learning templating in django. There were some problems with understanding their work.
For example, there is a skeleton template base.tpl :
<html>
<head>
<title>{% block title %}Родительский заголовок{% endblock %}</title>
</head>
<body>
{% block header %}{% endblock %}
{% block content %}{% endblock %}
{% block footer %}{% endblock %}
</body>
</html>
{% extends "template/base.tpl" %}
{% block title %} Дочерний заголовок {% endblock %}
def index(request):
return render(request, 'template/base.tpl');
def index(request):
return render(request, 'template/title.tpl');
Answer the question
In order to leave comments, you need to log in
misunderstood the essence of templates
def page_about(request):
return render(request, 'about.html');
{% extends "base.html" %}
{% block header %} Here is the title of about page{% endblock %}
{% block content %}content about page{% endblock %}
{% block footer %}footer for about page{% endblock %}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question