Maybe trying to do something not possible but basically, I created a file header.html that I include all other my html pages e.g. {% include "project/header.html" %} This works fine the challenge is that on header.html I want to put a dropdown menu with values coming from a model. it works fine if I invoke directly header.html but not when inside other page.
header.html
...
<ul>
{% for club in clubs.all %}
<li> <a href="#">{{ club.name }}</a></li>
{% endfor %}
...
views.py
from django.http import HttpResponse
from django.shortcuts import render
from .models import Club
def index(request):
clubs = Club.objects
return render(request, 'project/index.html',{'clubs':clubs})
Is this even possible? Thanks in advance