Beispiel #1
0
def serve_badge(request, campaign_id, badge_type='i'):
    if badge_type == 'e':
        objects = Badge.objects.filter(campaign__is_approved=True)
    else:
        objects = Badge.objects
    badge = get_object_or_404(objects, campaign=campaign_id, campaign__is_deleted=False, badge_type=badge_type)
    #response = serve_static(request, path=badge.image.path.replace('\\', '/'), document_root='/')
    response = serve_static(request, path=badge.image.name, document_root=settings.MEDIA_ROOT)
    return response
Beispiel #2
0
def serve_badge(request, event_id, badge_type='i'):
    if badge_type == 'e':
        objects = Badge.objects.filter(event__is_approved=True)
    else:
        objects = Badge.objects
    badge = get_object_or_404(objects, event=event_id, event__is_deleted=False, badge_type=badge_type)
    #response = serve_static(request, path=badge.image.path.replace('\\', '/'), document_root='/')
    response = serve_static(request, path=badge.image.name, document_root=settings.MEDIA_ROOT)
    return response
Beispiel #3
0
 def render_static(self, request, path, document_root=None):
     document_root = document_root or self.document_root
     return serve_static(request, path, document_root=document_root)
Beispiel #4
0
def serve(request, path):
    try:
        return serve_static(request, path, document_root=settings.STATIC_ROOT)
    except Http404:
        return serve_apps(request, path, insecure=True)
Beispiel #5
0
def download(request, path):
    return serve_static(request, path, settings.SHARING_DIRECTORY)
Beispiel #6
0
def media_view(request, *args, **kwargs):
    return serve_static(request, *args, **kwargs)
Beispiel #7
0
def media_view(request, *args, **kwargs):
    return serve_static(request, *args, **kwargs)
Beispiel #8
0
 def view_static(self, request, path):
     """
     Static file server.
     """
     return serve_static(request, path, document_root=self.document_root)