Refs #44 -- Added background queue support for file export

This commit is contained in:
Raphael Michel
2015-09-15 22:49:38 +02:00
parent 0530416c66
commit 9ecd16c19c
17 changed files with 270 additions and 19 deletions

View File

@@ -0,0 +1,22 @@
from django.http import HttpResponse
from django.shortcuts import get_object_or_404, redirect
from django.utils.functional import cached_property
from django.views.generic import TemplateView
from pretix.base.models import CachedFile
class DownloadView(TemplateView):
template_name = "pretixpresale/cachedfiles/pending.html"
@cached_property
def object(self):
return get_object_or_404(CachedFile, id=self.kwargs['id'])
def get(self, request, *args, **kwargs):
if 'ajax' in request.GET:
return HttpResponse('1' if self.object.file else '0')
elif self.object.file:
return redirect(self.object.file.url)
else:
return super().get(request, *args, **kwargs)