Mercurial > public > sg101
comparison gpp/potd/views.py @ 14:7b6540b185d9
Added get_absolute_url() for my comments. Had to add a get_absolute_url() function for downloads in the process.
author | Brian Neal <bgneal@gmail.com> |
---|---|
date | Sat, 18 Apr 2009 19:14:17 +0000 |
parents | dbd703f7d63a |
children |
comparison
equal
deleted
inserted
replaced
13:777451a98f9d | 14:7b6540b185d9 |
---|---|
1 """ | 1 """ |
2 Views for the POTD application. | 2 Views for the POTD application. |
3 """ | 3 """ |
4 | 4 |
5 from django.shortcuts import render_to_response | 5 from django.shortcuts import render_to_response |
6 from django.shortcuts import get_object_or_404 | |
6 from django.template import RequestContext | 7 from django.template import RequestContext |
7 | 8 |
8 from potd.models import Current | 9 from potd.models import Current |
10 from potd.models import Photo | |
9 | 11 |
10 | 12 |
11 def view(request): | 13 def view(request): |
12 potd = Current.objects.get_current_photo() | 14 potd = Current.objects.get_current_photo() |
13 return render_to_response('potd/view.html', { | 15 return render_to_response('potd/view.html', { |
14 'potd': potd, | 16 'potd': potd, |
17 'is_current': True, | |
15 }, | 18 }, |
16 context_instance = RequestContext(request)) | 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)) |