Ejemplo n.º 1
0
 def delete(self, request, *args, **kwargs):
     try:
         data_file = DataFile.get(self.domain, kwargs['pk'])
     except DataFile.DoesNotExist:
         raise Http404
     data_file.delete()
     return HttpResponse(status=204)
Ejemplo n.º 2
0
    def get(self, request, *args, **kwargs):
        try:
            data_file = DataFile.get(self.domain, kwargs['pk'])
            blob = data_file.get_blob()
        except (DataFile.DoesNotExist, NotFound):
            raise Http404

        format = Format('', data_file.content_type, '', True)
        return get_download_response(blob, data_file.content_length, format,
                                     data_file.filename, request)
Ejemplo n.º 3
0
    def get(self, request, *args, **kwargs):
        try:
            data_file = DataFile.get(self.domain, kwargs['pk'])
            blob = data_file.get_blob()
        except (DataFile.DoesNotExist, NotFound):
            raise Http404

        format = Format('', data_file.content_type, '', True)
        return get_download_response(
            blob, data_file.content_length, format, data_file.filename, request
        )