I have a html file that contains the following line:
core.html
{% include 'events/events.html' %}
And I have this other template:
events.html
{% for event in events %}
{{ event.event_name }} <br/>
{% endfor %}
When I open the URL that loads the events.html
it perfectly shows the data:
Evento 1
Pentaho Workshop
But when I open the main URL that loads core.html
it shows me nothing. If I write "blabla" out of the for
block it is shown!!!
Events -> views.py
from django.shortcuts import render
from models import Events
def events_index(request):
events = Events.objects.all()
return render(request, "events/events.html", locals())
Core -> views.py
from django.shortcuts import render
def core_index(request):
return render(request, "core/core.html", locals())
Could anyone help me?