From af68b0ccdea91baf3656c2051b83e2ca8e6a617b Mon Sep 17 00:00:00 2001 From: Johanna England Date: Thu, 3 Oct 2024 17:47:47 +0200 Subject: [PATCH] Uncrispify AlertProfilesForm in alert profiles --- python/nav/web/alertprofiles/forms.py | 34 +++++++++++++++++---------- 1 file changed, 22 insertions(+), 12 deletions(-) diff --git a/python/nav/web/alertprofiles/forms.py b/python/nav/web/alertprofiles/forms.py index 723dd46855..59874db48a 100644 --- a/python/nav/web/alertprofiles/forms.py +++ b/python/nav/web/alertprofiles/forms.py @@ -63,19 +63,29 @@ def __init__(self, *args, **kwargs): self.fields['daily_dispatch_time'].widget = forms.TimeInput(format='%H:%M') self.fields['weekly_dispatch_time'].widget = forms.TimeInput(format='%H:%M') - self.helper = FormHelper() - self.helper.form_tag = False - self.helper.layout = Layout( - 'id', - 'name', - Row( - Column('daily_dispatch_time', css_class='medium-4'), - Column('weekly_dispatch_time', css_class='medium-4'), - Column( - Field('weekly_dispatch_day', css_class='select2'), - css_class='medium-4', + self.fields['weekly_dispatch_day'].widget.attrs.update({'class': 'select2'}) + + self.attrs = set_flat_form_attributes( + form_fields=[ + self["id"], + self["name"], + FormRow( + fields=[ + FormColumn( + fields=[self["daily_dispatch_time"]], + css_classes="medium-4", + ), + FormColumn( + fields=[self["weekly_dispatch_time"]], + css_classes="medium-4", + ), + FormColumn( + fields=[self["weekly_dispatch_day"]], + css_classes="medium-4", + ), + ] ), - ), + ] ) class Meta(object):