Example #1
0
def serve_photo_by_id(request, photo_id):
    if request.method == 'GET':
        photo = Photo.objects(id=ObjectId(photo_id)).first()
        response = HttpResponse(photo.file.read())
        response['Content-Type'] = photo.file.content_type
        return response