Mercurial > public > sg101
comparison potd/views.py @ 1032:e932f2ecd4a7
Django 1.8 warnings / tech debt cleanup.
author | Brian Neal <bgneal@gmail.com> |
---|---|
date | Sat, 26 Dec 2015 15:10:55 -0600 |
parents | ee87ea74d46b |
children | 977e76f7f736 |
comparison
equal
deleted
inserted
replaced
1031:e1c03da72818 | 1032:e932f2ecd4a7 |
---|---|
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 |
6 from django.shortcuts import get_object_or_404 | 6 from django.shortcuts import get_object_or_404 |
7 from django.template import RequestContext | |
8 | 7 |
9 from potd.models import Current | 8 from potd.models import Current |
10 from potd.models import Photo | 9 from potd.models import Photo |
11 | 10 |
12 | 11 |
13 def view(request): | 12 def view(request): |
14 potd = Current.objects.get_current_photo() | 13 potd = Current.objects.get_current_photo() |
15 return render_to_response('potd/view.html', { | 14 return render(request, 'potd/view.html', { |
16 'potd': potd, | 15 'potd': potd, |
17 'is_current': True, | 16 'is_current': True, |
18 }, | 17 }) |
19 context_instance = RequestContext(request)) | 18 |
20 | 19 |
21 def archive(request, id): | 20 def archive(request, id): |
22 photo = get_object_or_404(Photo, pk=id) | 21 photo = get_object_or_404(Photo, pk=id) |
23 return render_to_response('potd/view.html', { | 22 return render(request, 'potd/view.html', { |
24 'potd': photo, | 23 'potd': photo, |
25 'is_current': False, | 24 'is_current': False, |
26 }, | 25 }) |
27 context_instance = RequestContext(request)) |