Ben Sturmfels
531a97a3c9
The directory nesting is unnecessary here and confusing to navigate. I've moved all apps to the project subdirectory, currently called "www", but soon to be renamed "conservancy". I've also moved manage.py to the top-level directory.
21 lines
669 B
Python
21 lines
669 B
Python
from datetime import datetime
|
|
|
|
from django.shortcuts import render
|
|
|
|
from .blog.models import Entry
|
|
from .news.models import PressRelease
|
|
from .supporters.models import Supporter
|
|
|
|
|
|
def view(request):
|
|
"""Conservancy front page view
|
|
|
|
Performs all object queries necessary to render the front page.
|
|
"""
|
|
now = datetime.now()
|
|
context = {
|
|
'press_releases': PressRelease.objects.all().filter(pub_date__lte=now, sites=2)[:5],
|
|
'supporters_count': Supporter.objects.all().filter(display_until_date__gte=now).count(),
|
|
'blog': Entry.objects.all().filter(pub_date__lte=now)[:5],
|
|
}
|
|
return render(request, "frontpage.html", context)
|