In my django project, I have a base.html from which all my templates {% extends 'base.html' %}. In that base template I want to do this to a list of all my algorithms.
{% for algorithm in algorithms %}
# list them out as links in nav bar
{% endfor %}
But I'm not passing algorithms to the base since it's just extending other templates.
I don't know how to solve this. My thought was to use {% load %} in the base template which would basically.
from algorithms.models import Algorithm
from django import template
register = template.Library()
def GetAlgorithmObjects():
a = Algorithm.objects.all()
return {'algorithms': a}
I'm not sure of how load works which would explain this failure. How would you actually implement this or should I go a different path.