Files
enviPy-bayer/bayer/context_processors.py
T
Tim Lorsbach 86c9ac887e
API CI / api-tests (pull_request) Failing after 32s
CI / test (pull_request) Failing after 33s
Added news entries
2026-10-21 09:53:58 +02:00

26 lines
591 B
Python

"""
Context processors for enviPy application.
Context processors automatically make variables available to all templates.
"""
from django.utils import timezone
from .models import NewsEntry
def news_entries_context(request):
"""
Provides package data for the search modal which is included globally
in framework_modern.html.
Returns:
dict: Context dictionary with reviewed and unreviewed packages
"""
qs = NewsEntry.objects.filter(publication_date__lte=timezone.now()).order_by('-publication_date')[:3]
return {
"news_entries": qs,
}