annotate potd/views.py @ 1088:360067908b35
Try to make podcast image responsive.
author |
Brian Neal <bgneal@gmail.com> |
date |
Wed, 04 May 2016 22:07:56 -0500 |
parents |
e932f2ecd4a7 |
children |
977e76f7f736 |
rev |
line source |
gremmie@1
|
1 """
|
gremmie@1
|
2 Views for the POTD application.
|
gremmie@1
|
3 """
|
gremmie@1
|
4
|
bgneal@1032
|
5 from django.shortcuts import render
|
bgneal@14
|
6 from django.shortcuts import get_object_or_404
|
gremmie@1
|
7
|
gremmie@1
|
8 from potd.models import Current
|
bgneal@14
|
9 from potd.models import Photo
|
gremmie@1
|
10
|
gremmie@1
|
11
|
gremmie@1
|
12 def view(request):
|
gremmie@1
|
13 potd = Current.objects.get_current_photo()
|
bgneal@1032
|
14 return render(request, 'potd/view.html', {
|
gremmie@1
|
15 'potd': potd,
|
bgneal@14
|
16 'is_current': True,
|
bgneal@1032
|
17 })
|
bgneal@1032
|
18
|
bgneal@14
|
19
|
bgneal@14
|
20 def archive(request, id):
|
bgneal@14
|
21 photo = get_object_or_404(Photo, pk=id)
|
bgneal@1032
|
22 return render(request, 'potd/view.html', {
|
bgneal@14
|
23 'potd': photo,
|
bgneal@14
|
24 'is_current': False,
|
bgneal@1032
|
25 })
|