From 189dca2be5fce2afa7c5716d36e0a8e7cdc880ee Mon Sep 17 00:00:00 2001 From: Simon Oliver Tveit Date: Thu, 10 Oct 2024 11:21:24 +0200 Subject: [PATCH] Uncrispify AccountLogSearchForm --- python/nav/web/radius/forms.py | 32 +++++++++++-------- .../nav/web/templates/radius/account_log.html | 3 +- 2 files changed, 20 insertions(+), 15 deletions(-) diff --git a/python/nav/web/radius/forms.py b/python/nav/web/radius/forms.py index a284c1fc80..a6eb3c9e34 100644 --- a/python/nav/web/radius/forms.py +++ b/python/nav/web/radius/forms.py @@ -21,7 +21,7 @@ from django.core.validators import validate_integer as django_validate_integer from crispy_forms.helper import FormHelper -from crispy_forms_foundation.layout import Layout, Row, Column, Submit +from crispy_forms_foundation.layout import Layout, Submit from nav.web.crispyforms import ( set_flat_form_attributes, FormColumn, @@ -218,18 +218,24 @@ def __init__(self, *args, **kwargs): super(AccountLogSearchForm, self).__init__(*args, **kwargs) css_class_large = 'large-4 medium-6' css_class_small = 'large-2 medium-6' - self.helper = FormHelper() - self.helper.form_action = '' - self.helper.form_method = 'GET' - self.helper.form_class = 'custom' - self.helper.layout = Layout( - Row( - Column('query', css_class=css_class_large), - Column('time', css_class=css_class_large), - Column('port_type', css_class=css_class_small), - Column('dns_lookup', css_class=css_class_small), - ), - Submit('send', 'Search', css_class='small'), + self.attrs = set_flat_form_attributes( + form_method='get', + form_class='custom', + form_fields=[ + FormRow( + fields=[ + FormColumn(fields=[self['query']], css_classes=css_class_large), + FormColumn(fields=[self['time']], css_classes=css_class_large), + FormColumn( + fields=[self['port_type']], css_classes=css_class_small + ), + FormColumn( + fields=[self['dns_lookup']], css_classes=css_class_small + ), + ] + ), + SubmitField(name='send', value='Search', css_classes='small'), + ], ) diff --git a/python/nav/web/templates/radius/account_log.html b/python/nav/web/templates/radius/account_log.html index 14185b5b10..931454fe23 100644 --- a/python/nav/web/templates/radius/account_log.html +++ b/python/nav/web/templates/radius/account_log.html @@ -1,5 +1,4 @@ {% extends "radius/base.html" %} -{% load crispy_forms_tags %} {% load radius %} @@ -18,7 +17,7 @@

Search in radius account logs

- {% crispy form %} + {% include 'custom_crispy_templates/flat_form.html' %}
{% if form.is_bound %}