Mercurial > public > sg101
comparison potd/views.py @ 581:ee87ea74d46b
For Django 1.4, rearranged project structure for new manage.py.
author | Brian Neal <bgneal@gmail.com> |
---|---|
date | Sat, 05 May 2012 17:10:48 -0500 |
parents | gpp/potd/views.py@7b6540b185d9 |
children | e932f2ecd4a7 |
comparison
equal
deleted
inserted
replaced
580:c525f3e0b5d0 | 581:ee87ea74d46b |
---|---|
1 """ | |
2 Views for the POTD application. | |
3 """ | |
4 | |
5 from django.shortcuts import render_to_response | |
6 from django.shortcuts import get_object_or_404 | |
7 from django.template import RequestContext | |
8 | |
9 from potd.models import Current | |
10 from potd.models import Photo | |
11 | |
12 | |
13 def view(request): | |
14 potd = Current.objects.get_current_photo() | |
15 return render_to_response('potd/view.html', { | |
16 'potd': potd, | |
17 'is_current': True, | |
18 }, | |
19 context_instance = RequestContext(request)) | |
20 | |
21 def archive(request, id): | |
22 photo = get_object_or_404(Photo, pk=id) | |
23 return render_to_response('potd/view.html', { | |
24 'potd': photo, | |
25 'is_current': False, | |
26 }, | |
27 context_instance = RequestContext(request)) |