Skip to content

Commit

Permalink
Merge pull request Uninett#3129 from Uninett/uncrispify/ErrorLogSearc…
Browse files Browse the repository at this point in the history
…hForm

Uncrispify ErrorLogSearchForm
  • Loading branch information
stveit authored Nov 8, 2024
2 parents c8865b9 + 293dc4f commit eb4d32b
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 13 deletions.
32 changes: 21 additions & 11 deletions python/nav/web/radius/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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'),
],
)


Expand Down
3 changes: 1 addition & 2 deletions python/nav/web/templates/radius/error_log.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
{% extends "radius/base.html" %}
{% load crispy_forms_tags %}
{% load report %}

{% block content %}
Expand All @@ -16,7 +15,7 @@ <h4 class="subheader">Search in radius error logs</h4>
</div>

<div id="forms">
{% crispy form %}
{% include 'custom_crispy_templates/flat_form.html' %}
</div>

{% if form.is_bound %}
Expand Down

0 comments on commit eb4d32b

Please sign in to comment.