forked from enviPath/enviPy
26 lines
591 B
Python
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,
|
|
}
|