From 476988f86184a8368d584d3e00dbd948c47fd64e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luiz=20Ot=C3=A1vio?= Date: Mon, 17 Apr 2023 08:09:01 -0300 Subject: [PATCH] =?UTF-8?q?Configurando=20templates=20globais=20com=20DIRS?= =?UTF-8?q?=20+=20=20extends=20para=20heran=C3=A7a=20de=20templates?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- aula207_ola_django/base/global/base.html | 12 ++++++++++++ aula207_ola_django/home/templates/home/index.html | 15 +++------------ aula207_ola_django/project/settings.py | 4 +++- 3 files changed, 18 insertions(+), 13 deletions(-) create mode 100644 aula207_ola_django/base/global/base.html diff --git a/aula207_ola_django/base/global/base.html b/aula207_ola_django/base/global/base.html new file mode 100644 index 0000000..c3cc65b --- /dev/null +++ b/aula207_ola_django/base/global/base.html @@ -0,0 +1,12 @@ + + + + + + + Document + + +

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

+ + diff --git a/aula207_ola_django/home/templates/home/index.html b/aula207_ola_django/home/templates/home/index.html index 03704ff..f7afce6 100644 --- a/aula207_ola_django/home/templates/home/index.html +++ b/aula207_ola_django/home/templates/home/index.html @@ -1,12 +1,3 @@ - - - - - - - Document - - -

HOME 2

- - \ No newline at end of file +{% extends 'global/base.html' %} + +{% block texto %} MUDAR O TEXTO {% endblock texto %} \ No newline at end of file diff --git a/aula207_ola_django/project/settings.py b/aula207_ola_django/project/settings.py index 23899d3..ca92270 100644 --- a/aula207_ola_django/project/settings.py +++ b/aula207_ola_django/project/settings.py @@ -56,7 +56,9 @@ ROOT_URLCONF = 'project.urls' TEMPLATES = [ { 'BACKEND': 'django.template.backends.django.DjangoTemplates', - 'DIRS': [], + 'DIRS': [ + BASE_DIR / 'base' + ], 'APP_DIRS': True, 'OPTIONS': { 'context_processors': [