From 89bb68d222ed651540d64cec503f0fa826097dbc Mon Sep 17 00:00:00 2001 From: Jan Tuomi Date: Tue, 17 Oct 2017 21:48:19 +0300 Subject: [PATCH] Also list custom roles in kaehmy form --- webapp/forms.py | 2 +- webapp/templates/kaehmy.html | 14 +++++++++++++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/webapp/forms.py b/webapp/forms.py index 956216c..292f034 100644 --- a/webapp/forms.py +++ b/webapp/forms.py @@ -39,7 +39,7 @@ class KaehmyForm_Form(forms.ModelForm): self.fields["phone_number"].label = _('Phone number (not public)') custom_roles_exist = CustomKaehmyRole.objects.all().exists() - self.fields["custom_roles"].widget = forms.widgets.CheckboxSelectMultiple if custom_roles_exist else forms.HiddenInput() + self.fields["custom_roles"].widget = forms.widgets.CheckboxSelectMultiple() if custom_roles_exist else forms.HiddenInput() self.fields["custom_roles"].help_text = "" self.fields["custom_roles"].label = _('Custom roles') self.fields["custom_roles"].queryset = CustomKaehmyRole.objects.all() diff --git a/webapp/templates/kaehmy.html b/webapp/templates/kaehmy.html index 5a73d76..e0f5a30 100644 --- a/webapp/templates/kaehmy.html +++ b/webapp/templates/kaehmy.html @@ -51,7 +51,19 @@ {% endif %} {% endfor %} - + + {% for custom_field in form %} + {% if custom_field.name == 'custom_roles' %} +
+
+ {{ custom_field.label }} +
+
+ {% bootstrap_field custom_field show_label=False %} +
+
+ {% endif %} + {% endfor %}
{% bootstrap_field form.custom_role_name %}