mirror of
https://github.com/Kunsi/pretalx-plugin-broadcast-tools
synced 2024-11-24 20:01:03 +00:00
add option to be able to choose which questions to include in pdf export
This commit is contained in:
parent
5930907aa1
commit
bfbce9e98b
3 changed files with 26 additions and 3 deletions
|
@ -32,6 +32,16 @@ class PDFInfoPage(Flowable):
|
||||||
self.style = style
|
self.style = style
|
||||||
self.y_position = PAGE_PADDING
|
self.y_position = PAGE_PADDING
|
||||||
|
|
||||||
|
@property
|
||||||
|
def _questions(self):
|
||||||
|
return {
|
||||||
|
int(i.strip())
|
||||||
|
for i in self.event.settings.broadcast_tools_pdf_questions_to_include.split(
|
||||||
|
","
|
||||||
|
)
|
||||||
|
if i
|
||||||
|
}
|
||||||
|
|
||||||
def _add(self, item, gap=2):
|
def _add(self, item, gap=2):
|
||||||
_, height = item.wrapOn(
|
_, height = item.wrapOn(
|
||||||
self.canv, A4_WIDTH - 2 * PAGE_PADDING, A4_HEIGHT - 2 * PAGE_PADDING
|
self.canv, A4_WIDTH - 2 * PAGE_PADDING, A4_HEIGHT - 2 * PAGE_PADDING
|
||||||
|
@ -157,9 +167,11 @@ class PDFInfoPage(Flowable):
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
if self.talk.submission.answers:
|
if self.talk.submission.answers and self._questions:
|
||||||
self._space()
|
self._space()
|
||||||
for answer in sorted(self.talk.submission.answers.all()):
|
for answer in sorted(self.talk.submission.answers.all()):
|
||||||
|
if answer.question.id not in self._questions:
|
||||||
|
continue
|
||||||
self._question_text(
|
self._question_text(
|
||||||
str(answer.question.question),
|
str(answer.question.question),
|
||||||
answer.answer,
|
answer.answer,
|
||||||
|
@ -246,7 +258,9 @@ class PDFExporter(ScheduleData):
|
||||||
ParagraphStyle(name="Meta", fontName="Helvetica", fontSize=14, leading=16)
|
ParagraphStyle(name="Meta", fontName="Helvetica", fontSize=14, leading=16)
|
||||||
)
|
)
|
||||||
stylesheet.add(
|
stylesheet.add(
|
||||||
ParagraphStyle(name="Question", fontName="Helvetica", fontSize=12, leading=14)
|
ParagraphStyle(
|
||||||
|
name="Question", fontName="Helvetica", fontSize=12, leading=14
|
||||||
|
)
|
||||||
)
|
)
|
||||||
stylesheet.add(
|
stylesheet.add(
|
||||||
ParagraphStyle(
|
ParagraphStyle(
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
from django.forms import BooleanField
|
from django.forms import BooleanField, CharField
|
||||||
from django.utils.translation import gettext_lazy as _
|
from django.utils.translation import gettext_lazy as _
|
||||||
from hierarkey.forms import HierarkeyForm
|
from hierarkey.forms import HierarkeyForm
|
||||||
from i18nfield.forms import I18nFormField, I18nFormMixin, I18nTextInput
|
from i18nfield.forms import I18nFormField, I18nFormMixin, I18nTextInput
|
||||||
|
@ -35,3 +35,11 @@ class BroadcastToolsSettingsForm(I18nFormMixin, HierarkeyForm):
|
||||||
label=_("Ignore 'do not record' talks when generating pdf"),
|
label=_("Ignore 'do not record' talks when generating pdf"),
|
||||||
required=False,
|
required=False,
|
||||||
)
|
)
|
||||||
|
broadcast_tools_pdf_questions_to_include = CharField(
|
||||||
|
help_text=_(
|
||||||
|
"Comma-Separated list of question ids to include in pdf export. "
|
||||||
|
"If empty, no questions will get added."
|
||||||
|
),
|
||||||
|
label=_("Questions to include"),
|
||||||
|
required=False,
|
||||||
|
)
|
||||||
|
|
|
@ -42,6 +42,7 @@
|
||||||
</legend>
|
</legend>
|
||||||
{% bootstrap_field form.broadcast_tools_pdf_show_internal_notes layout='event' %}
|
{% bootstrap_field form.broadcast_tools_pdf_show_internal_notes layout='event' %}
|
||||||
{% bootstrap_field form.broadcast_tools_pdf_ignore_do_not_record layout='event' %}
|
{% bootstrap_field form.broadcast_tools_pdf_ignore_do_not_record layout='event' %}
|
||||||
|
{% bootstrap_field form.broadcast_tools_pdf_questions_to_include layout='event' %}
|
||||||
</fieldset>
|
</fieldset>
|
||||||
<fieldset>
|
<fieldset>
|
||||||
<div class="submit-group panel">
|
<div class="submit-group panel">
|
||||||
|
|
Loading…
Reference in a new issue