@login_required
def photos(request, template_name="photos/latest.html"):
    
    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("-date_added")
    
    ctx = group_context(group, bridge)
    ctx.update({
        "photos": photos,
        "title": "Latest Photos"
    })
    
    return render_to_response(template_name, RequestContext(request, ctx))
latest photos
dataset/ETHPy150Open amarandon/smeuhsocial/apps/photos/views.py/photos