publishers_16.py 354 B

12345678910
  1. def content_download(request, content_id):
  2. content = models.Content.objects.get(pk=content_id)
  3. response = StreamingHttpResponse(open(content.file, "r"))
  4. response["Content-Type"] = "application/octet-stream"
  5. response["Content-Disposition"] = 'attachment; filename="%s"' % os.path.basename(
  6. content.file
  7. )
  8. return response