Usando o context para enviar dados para dentro dos templates

This commit is contained in:
Luiz Otávio
2023-04-21 11:11:57 -03:00
parent dc90353228
commit 34374a59c7
6 changed files with 27 additions and 7 deletions

View File

@@ -1,3 +1,5 @@
{% extends 'global/base.html' %}
{% block texto %} MUDAR O TEXTO {% endblock texto %}
{% block texto %}
{{ text }}
{% endblock texto %}

View File

@@ -4,7 +4,12 @@ from django.shortcuts import render
def home(request):
print('home')
context = {
'text': 'Olá home'
}
return render(
request,
'home/index.html'
'home/index.html',
context,
)