Compatibility with an external file storage separated in pub/ and priv/

This commit is contained in:
Raphael Michel
2018-03-20 09:32:20 +01:00
parent 511cdbbfe2
commit 840cee206a
7 changed files with 14 additions and 11 deletions

View File

@@ -317,7 +317,7 @@ class PdfTicketOutput(BaseTicketOutput):
bgf = default_storage.open(bg_file.name, "rb")
else:
bgf = self._get_default_background()
bg_pdf = PdfFileReader(bgf)
bg_pdf = PdfFileReader(BytesIO(bgf.read()))
for page in new_pdf.pages:
bg_page = copy.copy(bg_pdf.getPage(0))

View File

@@ -138,7 +138,7 @@ class EditorView(EventPermissionRequiredMixin, TemplateView):
# Create new file
nonce = get_random_string(length=8)
fname = '%s-%s/%s/%s.%s.%s' % (
fname = 'pub/%s-%s/%s/%s.%s.%s' % (
'event', 'settings', self.request.event.pk, 'ticketoutput_{}_layout'.format(self.identifier), nonce, 'pdf'
)
newname = default_storage.save(fname, cf.file)