mirror of
https://github.com/Kunsi/pretalx-plugin-broadcast-tools
synced 2024-11-22 01:01:02 +00:00
code style improvements in pdf exporter
This commit is contained in:
parent
25fe8b804e
commit
24acd451ad
2 changed files with 18 additions and 6 deletions
|
@ -1,10 +1,7 @@
|
||||||
from tempfile import NamedTemporaryFile
|
from tempfile import NamedTemporaryFile
|
||||||
|
|
||||||
from django.http import HttpResponse
|
|
||||||
from django.utils.timezone import now
|
from django.utils.timezone import now
|
||||||
from pretalx.schedule.exporters import ScheduleData
|
from pretalx.schedule.exporters import ScheduleData
|
||||||
from pretalx.submission.models import SubmissionStates
|
|
||||||
from reportlab.graphics import renderPDF
|
|
||||||
from reportlab.lib import colors
|
from reportlab.lib import colors
|
||||||
from reportlab.lib.enums import TA_CENTER
|
from reportlab.lib.enums import TA_CENTER
|
||||||
from reportlab.lib.pagesizes import A4
|
from reportlab.lib.pagesizes import A4
|
||||||
|
@ -13,7 +10,6 @@ from reportlab.lib.units import mm
|
||||||
from reportlab.platypus import (
|
from reportlab.platypus import (
|
||||||
Flowable,
|
Flowable,
|
||||||
PageBreak,
|
PageBreak,
|
||||||
PageTemplate,
|
|
||||||
Paragraph,
|
Paragraph,
|
||||||
SimpleDocTemplate,
|
SimpleDocTemplate,
|
||||||
Spacer,
|
Spacer,
|
||||||
|
@ -63,7 +59,16 @@ class PDFInfoPage(Flowable):
|
||||||
self.canv.drawString(
|
self.canv.drawString(
|
||||||
-(A4_HEIGHT - (PAGE_PADDING / 3)),
|
-(A4_HEIGHT - (PAGE_PADDING / 3)),
|
||||||
-(PAGE_PADDING / 3),
|
-(PAGE_PADDING / 3),
|
||||||
f"{self.talk.submission.code} | {self.talk.submission.submission_type.name} | {self.event.name} | {self.talk.local_start.isoformat()} | Day {self.day['index']} | {self.room['name']}",
|
" | ".join(
|
||||||
|
[
|
||||||
|
self.talk.submission.code,
|
||||||
|
str(self.talk.submission.submission_type.name),
|
||||||
|
str(self.event.name),
|
||||||
|
self.talk.local_start.isoformat(),
|
||||||
|
f"Day {self.day['index']}",
|
||||||
|
str(self.room["name"]),
|
||||||
|
],
|
||||||
|
),
|
||||||
)
|
)
|
||||||
self.canv.restoreState()
|
self.canv.restoreState()
|
||||||
|
|
||||||
|
@ -76,7 +81,13 @@ class PDFInfoPage(Flowable):
|
||||||
|
|
||||||
self._add(
|
self._add(
|
||||||
Paragraph(
|
Paragraph(
|
||||||
f"{self.event.name} | {self.room['name']} | {self.talk.local_start.strftime('%F %T')} {self.event.timezone}",
|
" | ".join(
|
||||||
|
[
|
||||||
|
str(self.event.name),
|
||||||
|
str(self.room["name"]),
|
||||||
|
f"{self.talk.local_start.strftime('%F %T')} {self.event.timezone}",
|
||||||
|
],
|
||||||
|
),
|
||||||
style=self.style["Meta"],
|
style=self.style["Meta"],
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
|
@ -40,4 +40,5 @@ def navbar_info(sender, request, **kwargs):
|
||||||
@receiver(register_data_exporters, dispatch_uid="exporter_myexporter")
|
@receiver(register_data_exporters, dispatch_uid="exporter_myexporter")
|
||||||
def register_data_exporter(sender, **kwargs):
|
def register_data_exporter(sender, **kwargs):
|
||||||
from .exporter import PDFExporter
|
from .exporter import PDFExporter
|
||||||
|
|
||||||
return PDFExporter
|
return PDFExporter
|
||||||
|
|
Loading…
Reference in a new issue