Configurando templates globais com DIRS + extends para herança de templates
This commit is contained in:
12
aula207_ola_django/base/global/base.html
Normal file
12
aula207_ola_django/base/global/base.html
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8" />
|
||||||
|
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||||
|
<title>Document</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<h1>{% block texto %} BASE {% endblock texto %}</h1>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
@@ -1,12 +1,3 @@
|
|||||||
<!DOCTYPE html>
|
{% extends 'global/base.html' %}
|
||||||
<html lang="en">
|
|
||||||
<head>
|
{% block texto %} MUDAR O TEXTO {% endblock texto %}
|
||||||
<meta charset="UTF-8">
|
|
||||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
||||||
<title>Document</title>
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<h1>HOME 2</h1>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
@@ -56,7 +56,9 @@ ROOT_URLCONF = 'project.urls'
|
|||||||
TEMPLATES = [
|
TEMPLATES = [
|
||||||
{
|
{
|
||||||
'BACKEND': 'django.template.backends.django.DjangoTemplates',
|
'BACKEND': 'django.template.backends.django.DjangoTemplates',
|
||||||
'DIRS': [],
|
'DIRS': [
|
||||||
|
BASE_DIR / 'base'
|
||||||
|
],
|
||||||
'APP_DIRS': True,
|
'APP_DIRS': True,
|
||||||
'OPTIONS': {
|
'OPTIONS': {
|
||||||
'context_processors': [
|
'context_processors': [
|
||||||
|
|||||||
Reference in New Issue
Block a user