+ super(DownloadFormatsForm, self).__init__(*args, **kwargs)
+
+
+CUSTOMIZATION_FLAGS = (
+ ('nofootnotes', _("Don't show footnotes")),
+ ('nothemes', _("Don't disply themes")),
+ ('nowlfont', _("Don't use our custom font")),
+ )
+CUSTOMIZATION_OPTIONS = (
+ ('leading', _("Leading"), (
+ ('defaultleading', _('Normal leading')),
+ ('onehalfleading', _('One and a half leading')),
+ ('doubleleading', _('Double leading')),
+ )),
+ ('fontsize', _("Font size"), (
+ ('11pt', _('Default')),
+ ('13pt', _('Big'))
+ )),
+# ('pagesize', _("Paper size"), (
+# ('a4paper', _('A4')),
+# ('a5paper', _('A5')),
+# )),
+ )
+
+
+class CustomPDFForm(forms.Form):
+ def __init__(self, *args, **kwargs):
+ super(CustomPDFForm, self).__init__(*args, **kwargs)
+ for name, label in CUSTOMIZATION_FLAGS:
+ self.fields[name] = forms.BooleanField(required=False, label=label)
+ for name, label, choices in CUSTOMIZATION_OPTIONS:
+ self.fields[name] = forms.ChoiceField(choices, label=label)
+
+ @property
+ def customizations(self):
+ c = []
+ for name, label in CUSTOMIZATION_FLAGS:
+ if self.cleaned_data.get(name):
+ c.append(name)
+ for name, label, choices in CUSTOMIZATION_OPTIONS:
+ c.append(self.cleaned_data[name])
+ c.sort()
+ return c