Files @ a8710b4b9f2a
Branch filter:

Location: website/www/conservancy/frontpage.py - annotation

Denver Gingerich
Copyleft Compliance: mostly minor fixes to new pgs

These are mostly minor edits (typo fixes, etc.) to the enforcement
strategy and firmware liberation pages that were just added.

The one large change was to replace the first paragraph of the
enforcement strategy page with the full Conservancy description used
previously. The glue text used to shorten it appeared unsalvageable
and it wasn't immediately obvious how to replace it with something
better, so we used the full description instead.
from conservancy import render_template_with_context
from conservancy.apps.supporters.models import Supporter as Supporter
from conservancy.apps.news.models import PressRelease
from conservancy.apps.blog.models import Entry as BlogEntry
from datetime import datetime

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': len(Supporter.objects.all().filter(display_until_date__gte=now)),
        'blog': BlogEntry.objects.all().filter(pub_date__lte=now)[:5],
    }
    return render_template_with_context(request, "frontpage.html", context)