from django.contrib.auth.decorators import permission_required
from django.urls import reverse
from django.db.models import Q, Max
from django.contrib.auth.decorators import permission_required
from django.urls import reverse
from django.db.models import Q, Max
audiobook.save()
return redirect(file_managed, aid)
def download(request, aid, which="source"):
audiobook.save()
return redirect(file_managed, aid)
def download(request, aid, which="source"):
response['Content-Disposition'] = "attachment; filename*=UTF-8''%s.%s" % (
quote(audiobook.title.encode('utf-8'), safe=''), ext)
response['Content-Disposition'] = "attachment; filename*=UTF-8''%s.%s" % (
quote(audiobook.title.encode('utf-8'), safe=''), ext)
- response['X-Sendfile'] = file_.path.encode('utf-8')
+ with open(file_.path, 'rb') as f:
+ response.write(f.read())
+ #response['X-Sendfile'] = file_.path.encode('utf-8')