gremmie@1: """ gremmie@1: Views for the POTD application. gremmie@1: """ gremmie@1: bgneal@1032: from django.shortcuts import render bgneal@14: from django.shortcuts import get_object_or_404 gremmie@1: gremmie@1: from potd.models import Current bgneal@14: from potd.models import Photo gremmie@1: gremmie@1: gremmie@1: def view(request): gremmie@1: potd = Current.objects.get_current_photo() bgneal@1032: return render(request, 'potd/view.html', { gremmie@1: 'potd': potd, bgneal@14: 'is_current': True, bgneal@1032: }) bgneal@1032: bgneal@14: bgneal@14: def archive(request, id): bgneal@14: photo = get_object_or_404(Photo, pk=id) bgneal@1032: return render(request, 'potd/view.html', { bgneal@14: 'potd': photo, bgneal@14: 'is_current': False, bgneal@1032: })