Skip to content

Instantly share code, notes, and snippets.

@robhudson
Created July 21, 2015 00:13
Show Gist options
  • Save robhudson/ad76b777e337ef62f6ef to your computer and use it in GitHub Desktop.
Save robhudson/ad76b777e337ef62f6ef to your computer and use it in GitHub Desktop.
diff --git a/mkt/comm/views.py b/mkt/comm/views.py
index bec28fc..0979a14 100644
--- a/mkt/comm/views.py
+++ b/mkt/comm/views.py
@@ -1,6 +1,8 @@
import os
from django.conf import settings
+from django.core.files.storage import default_storage as storage
+from django.http import HttpResponseRedirect
from django.shortcuts import get_object_or_404
from rest_framework import status
@@ -202,8 +204,8 @@ class AttachmentViewSet(CreateModelMixin, CommViewSet):
content_type = 'application/force-download'
if attach.is_image():
content_type = 'image'
- return HttpResponseSendFile(
- request, full_path, content_type=content_type)
+
+ return HttpResponseRedirect(storage.url(full_path))
def create(self, request, note_id, *args, **kwargs):
note = get_object_or_404(CommunicationNote, id=note_id)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment