forked from enviPath/enviPy
Added news entries
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
"""
|
||||
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,
|
||||
}
|
||||
Reference in New Issue
Block a user