Mercurial > public > sg101
comparison gpp/podcast/views.py @ 1:dbd703f7d63a
Initial import of sg101 stuff from private repository.
author | gremmie |
---|---|
date | Mon, 06 Apr 2009 02:43:12 +0000 |
parents | |
children | 1ed461fd2030 |
comparison
equal
deleted
inserted
replaced
0:900ba3c7b765 | 1:dbd703f7d63a |
---|---|
1 """Views for the podcast application""" | |
2 | |
3 from django.shortcuts import render_to_response | |
4 from django.template import RequestContext | |
5 from django.shortcuts import get_object_or_404 | |
6 | |
7 from podcast.models import Channel | |
8 from podcast.models import Item | |
9 | |
10 | |
11 def index(request): | |
12 try: | |
13 channel = Channel.objects.get(pk=1) | |
14 except Channel.DoesNotExist: | |
15 channel = None | |
16 | |
17 return render_to_response('podcast/index.html', { | |
18 'channel': channel, | |
19 }, | |
20 context_instance = RequestContext(request)) | |
21 | |
22 | |
23 def detail(request, id): | |
24 podcast = get_object_or_404(Item, pk = id) | |
25 return render_to_response('podcast/detail.html', { | |
26 'channel': podcast.channel, | |
27 'podcast': podcast, | |
28 }, | |
29 context_instance = RequestContext(request)) | |
30 | |
31 | |
32 def feed(request): | |
33 try: | |
34 channel = Channel.objects.get(pk=1) | |
35 except Channel.DoesNotExist: | |
36 channel = None | |
37 return render_to_response('podcast/feed.xml', { | |
38 'channel': channel, | |
39 }, | |
40 context_instance = RequestContext(request)) |