annotate 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 |
rev |
line source |
gremmie@1
|
1 """Views for the podcast application"""
|
gremmie@1
|
2
|
gremmie@1
|
3 from django.shortcuts import render_to_response
|
gremmie@1
|
4 from django.template import RequestContext
|
gremmie@1
|
5 from django.shortcuts import get_object_or_404
|
gremmie@1
|
6
|
gremmie@1
|
7 from podcast.models import Channel
|
gremmie@1
|
8 from podcast.models import Item
|
gremmie@1
|
9
|
gremmie@1
|
10
|
gremmie@1
|
11 def index(request):
|
gremmie@1
|
12 try:
|
gremmie@1
|
13 channel = Channel.objects.get(pk=1)
|
gremmie@1
|
14 except Channel.DoesNotExist:
|
gremmie@1
|
15 channel = None
|
gremmie@1
|
16
|
gremmie@1
|
17 return render_to_response('podcast/index.html', {
|
gremmie@1
|
18 'channel': channel,
|
gremmie@1
|
19 },
|
gremmie@1
|
20 context_instance = RequestContext(request))
|
gremmie@1
|
21
|
gremmie@1
|
22
|
gremmie@1
|
23 def detail(request, id):
|
gremmie@1
|
24 podcast = get_object_or_404(Item, pk = id)
|
gremmie@1
|
25 return render_to_response('podcast/detail.html', {
|
gremmie@1
|
26 'channel': podcast.channel,
|
gremmie@1
|
27 'podcast': podcast,
|
gremmie@1
|
28 },
|
gremmie@1
|
29 context_instance = RequestContext(request))
|
gremmie@1
|
30
|
gremmie@1
|
31
|
gremmie@1
|
32 def feed(request):
|
gremmie@1
|
33 try:
|
gremmie@1
|
34 channel = Channel.objects.get(pk=1)
|
gremmie@1
|
35 except Channel.DoesNotExist:
|
gremmie@1
|
36 channel = None
|
gremmie@1
|
37 return render_to_response('podcast/feed.xml', {
|
gremmie@1
|
38 'channel': channel,
|
gremmie@1
|
39 },
|
gremmie@1
|
40 context_instance = RequestContext(request))
|