Why can I not get any text to appear from my function in my contect-processor.py
to work?
PROJECT
-|project
-|careers
-|models.py
-|context_processor.py
-|templates
-|template.html
context_processors.py
from .models import Careers
def careers_exist(request):
# Check if there are any active careers
careers_available = Careers.objects.filter(active=True).exists()
# Prepare the context dictionary based on availability
if careers_available:
header = {'header': 'Current vacancies'}
else:
header = {'header': 'No Vacancies'}
return {'header' : header}
template.html
<h2>{{ header.header }}</h2>
Why is my template still blank despite doing everything correctly.
5