gremmie@1: """Views for the podcast application""" gremmie@1: gremmie@1: from django.shortcuts import render_to_response gremmie@1: from django.template import RequestContext gremmie@1: from django.shortcuts import get_object_or_404 gremmie@1: gremmie@1: from podcast.models import Channel gremmie@1: from podcast.models import Item gremmie@1: gremmie@1: gremmie@1: def index(request): gremmie@1: try: gremmie@1: channel = Channel.objects.get(pk=1) gremmie@1: except Channel.DoesNotExist: gremmie@1: channel = None gremmie@1: gremmie@1: return render_to_response('podcast/index.html', { gremmie@1: 'channel': channel, gremmie@1: }, gremmie@1: context_instance = RequestContext(request)) gremmie@1: gremmie@1: gremmie@1: def detail(request, id): gremmie@1: podcast = get_object_or_404(Item, pk = id) gremmie@1: return render_to_response('podcast/detail.html', { gremmie@1: 'channel': podcast.channel, gremmie@1: 'podcast': podcast, gremmie@1: }, gremmie@1: context_instance = RequestContext(request)) gremmie@1: gremmie@1: gremmie@1: def feed(request): gremmie@1: try: gremmie@1: channel = Channel.objects.get(pk=1) gremmie@1: except Channel.DoesNotExist: gremmie@1: channel = None gremmie@1: return render_to_response('podcast/feed.xml', { gremmie@1: 'channel': channel, gremmie@1: }, gremmie@1: context_instance = RequestContext(request))