Skip to content

Commit

Permalink
Merge pull request Uninett#3130 from Uninett/uncrispify/AccountLogSea…
Browse files Browse the repository at this point in the history
…rchForm

Uncrispify AccountLogSearchForm
  • Loading branch information
stveit authored Nov 8, 2024
2 parents eb4d32b + 189dca2 commit eca2e0d
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 15 deletions.
32 changes: 19 additions & 13 deletions python/nav/web/radius/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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'),
],
)


Expand Down
3 changes: 1 addition & 2 deletions python/nav/web/templates/radius/account_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 radius %}

Expand All @@ -18,7 +17,7 @@ <h4 class="subheader">Search in radius account 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 eca2e0d

Please sign in to comment.