Skip to content
Snippets Groups Projects
Commit 4dff3185 authored by markus scheller's avatar markus scheller
Browse files

Add configuration SelectField for latex_template selection

parent 7ba49fdd
No related branches found
No related tags found
1 merge request!8Feature: Typ kann LaTeX-Template wählen
......@@ -59,6 +59,17 @@ def get_printer_choices():
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()
groups = sorted(user.groups)
......@@ -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
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment