Beispiel #1
0
def show(request, pid):
    photo = get_object_or_404(Photo, pk = pid)
    category = photo_category(photo)
    if not request.user.is_staff:
        record_photo_view(photo)
    image = photo.get_thumbnail("Large")
    return render_to_response('picture.html', locals(),
                                  context_instance=RequestContext(request))
Beispiel #2
0
def today(request):
    from datetime import date
    dt = date.today()
    try:
        dp = DailyPhoto.objects.get(dt=dt)
        category = photo_category(dp.photo)
        if not request.user.is_staff:
            record_photo_view(dp.photo)
        image = dp.photo.get_thumbnail('Large')
    except DailyPhoto.DoesNotExist:
        dp = None
    return render_to_response('today.html', locals(),
                              context_instance=RequestContext(request))