Files @ 956f8c6fdaad
Branch filter:

Location: website/conservancy/frontpage.py

bsturmfels
podjango: Add "Podcast" model to support multiple podcasts

Each Cast (episode) can belong to one or more Podcast, allowing episodes to be
shared between podcasts. This enables us introductory episodes to be delivered
in their own feed, but also included in the main "The Corresponding Source"
feed.

This required adding an additional `podcast_slug` argument to most views. The
date archive views were dropped because they're not linked to from anywhere.

Added a `podcasts` view as an index of all available Podcasts.
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)