Commit 4dff3185 authored by markus scheller's avatar markus scheller
Browse files

Add configuration SelectField for latex_template selection

#170
parent 7ba49fdd
......@@ -58,6 +58,17 @@ def get_printer_choices():
choices = list(zip(config.PRINTING_PRINTERS, config.PRINTING_PRINTERS))
choices.insert(0, ("", "Nicht drucken"))
return choices
def get_latex_template_choices():
choices = []
if config.LATEX_TEMPLATES is not None:
choices = [
(key, values['name'])
for key, values
in config.LATEX_TEMPLATES.items()
]
choices.insert(0, ("", "Standardvorlage"))
return choices
def get_group_choices():
user = current_user()
......@@ -130,12 +141,14 @@ class ProtocolTypeForm(FlaskForm):
calendar = SelectField("Kalender", choices=[])
restrict_networks = BooleanField("Netzwerke einschränken")
allowed_networks = IPNetworkField("Erlaubte Netzwerke")
latex_template = SelectField("LaTeX Vorlage", choices=[])
def __init__(self, **kwargs):
super().__init__(**kwargs)
protocoltype = kwargs["obj"] if "obj" in kwargs else None
self.calendar.choices = get_calendar_choices(protocoltype=protocoltype)
self.printer.choices = get_printer_choices()
self.latex_template.choices = get_latex_template_choices()
group_choices = get_group_choices()
self.publish_group.choices = group_choices
self.modify_group.choices = group_choices
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment