

@login_required
def most_viewed(request, template_name='photos/latest.html'):
    '\n    latest photos\n    '
    (group, bridge) = group_and_bridge(request)
    photos = Image.objects.filter(((Q(is_public=True) | Q(member=request.user)) | Q(member__in=friend_set_for(request.user))))
    if group:
        photos = group.content_objects(photos, join='pool', gfk_field='content_object')
    else:
        photos = photos.filter(pool__object_id=None)
    photos = photos.order_by('-view_count')
    ctx = group_context(group, bridge)
    ctx.update({
        'photos': photos,
        'title': _('Most Viewed Photos'),
    })
    return render_to_response(template_name, RequestContext(request, ctx))

dataset/ETHPy150Open amarandon/smeuhsocial/apps/photos/views.py most_viewed/original