Usando if, elif e else dentro do template HTML do Django

This commit is contained in:
Luiz Otávio
2023-04-26 15:51:53 -03:00
parent 72b77da228
commit b03360b1f8
2 changed files with 4 additions and 2 deletions

View File

@@ -1,7 +1,9 @@
{% include 'global/partials/head.html' %}
{% include 'global/partials/menu.html' %}
<h1>{% block texto %}{% endblock texto %}</h1>
{% if text %}
<h1>{% block texto %}{% endblock texto %}</h1>
{% endif %}
<main class="content">
{% block posts %}{% endblock posts %}

View File

@@ -6,7 +6,7 @@ def blog(request):
print('blog')
context = {
'text': 'Olá blog',
# 'text': 'Olá blog',
'posts': posts
}