From 293dc4f20d7c0b7a7cfedb5ad7f37001de283a7b Mon Sep 17 00:00:00 2001 From: Simon Oliver Tveit Date: Thu, 10 Oct 2024 11:13:11 +0200 Subject: [PATCH] Uncrispify ErrorLogSearchForm --- python/nav/web/radius/forms.py | 32 ++++++++++++------- .../nav/web/templates/radius/error_log.html | 3 +- 2 files changed, 22 insertions(+), 13 deletions(-) diff --git a/python/nav/web/radius/forms.py b/python/nav/web/radius/forms.py index a9f33e87d1..a284c1fc80 100644 --- a/python/nav/web/radius/forms.py +++ b/python/nav/web/radius/forms.py @@ -22,6 +22,12 @@ from crispy_forms.helper import FormHelper from crispy_forms_foundation.layout import Layout, Row, Column, Submit +from nav.web.crispyforms import ( + set_flat_form_attributes, + FormColumn, + FormRow, + SubmitField, +) from nav.util import is_valid_cidr @@ -146,17 +152,21 @@ class ErrorLogSearchForm(forms.Form): def __init__(self, *args, **kwargs): super(ErrorLogSearchForm, self).__init__(*args, **kwargs) css_class = 'medium-4' - 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), - Column('log_entry_type', css_class=css_class), - Column('time', css_class=css_class), - ), - 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), + FormColumn( + fields=[self['log_entry_type']], css_classes=css_class + ), + FormColumn(fields=[self['time']], css_classes=css_class), + ] + ), + SubmitField(name='send', value='Search', css_classes='small'), + ], ) diff --git a/python/nav/web/templates/radius/error_log.html b/python/nav/web/templates/radius/error_log.html index 41e8ac78c7..6e3c0f481f 100644 --- a/python/nav/web/templates/radius/error_log.html +++ b/python/nav/web/templates/radius/error_log.html @@ -1,5 +1,4 @@ {% extends "radius/base.html" %} -{% load crispy_forms_tags %} {% load report %} {% block content %} @@ -16,7 +15,7 @@

Search in radius error logs

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