From b03360b1f8ae274f129f465461859091661d3b70 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luiz=20Ot=C3=A1vio?= Date: Wed, 26 Apr 2023 15:51:53 -0300 Subject: [PATCH] Usando if, elif e else dentro do template HTML do Django --- aula207_ola_django/base/global/base.html | 4 +++- aula207_ola_django/blog/views.py | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/aula207_ola_django/base/global/base.html b/aula207_ola_django/base/global/base.html index 1f7a678..33fcddc 100644 --- a/aula207_ola_django/base/global/base.html +++ b/aula207_ola_django/base/global/base.html @@ -1,7 +1,9 @@ {% include 'global/partials/head.html' %} {% include 'global/partials/menu.html' %} -

{% block texto %}{% endblock texto %}

+{% if text %} +

{% block texto %}{% endblock texto %}

+{% endif %}
{% block posts %}{% endblock posts %} diff --git a/aula207_ola_django/blog/views.py b/aula207_ola_django/blog/views.py index 63625aa..bc00ba7 100644 --- a/aula207_ola_django/blog/views.py +++ b/aula207_ola_django/blog/views.py @@ -6,7 +6,7 @@ def blog(request): print('blog') context = { - 'text': 'Olá blog', + # 'text': 'Olá blog', 'posts': posts }