annotate potd/views.py @ 1185:8ec03abf16c1

Part of the last commit. :(
author Brian Neal <bgneal@gmail.com>
date Sun, 17 Oct 2021 15:07:54 -0500
parents 977e76f7f736
children
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@1107 17 'V3_DESIGN': True,
bgneal@1032 18 })
bgneal@1032 19
bgneal@14 20
bgneal@14 21 def archive(request, id):
bgneal@14 22 photo = get_object_or_404(Photo, pk=id)
bgneal@1032 23 return render(request, 'potd/view.html', {
bgneal@14 24 'potd': photo,
bgneal@14 25 'is_current': False,
bgneal@1107 26 'V3_DESIGN': True,
bgneal@1032 27 })