diff --git a/python/nav/web/l2trace/forms.py b/python/nav/web/l2trace/forms.py
index e03678ee71..ca977bd9ac 100644
--- a/python/nav/web/l2trace/forms.py
+++ b/python/nav/web/l2trace/forms.py
@@ -14,8 +14,12 @@
# License along with NAV. If not, see .
#
-from crispy_forms.helper import FormHelper
-from crispy_forms_foundation.layout import Layout, Row, Column, Submit, Field
+from nav.web.crispyforms import (
+ set_flat_form_attributes,
+ FormRow,
+ FormColumn,
+ SubmitField,
+)
from django.core.exceptions import MultipleObjectsReturned
from django import forms
@@ -33,22 +37,20 @@ def __init__(self, *args, **kwargs):
super(L2TraceForm, self).__init__(*args, **kwargs)
placeholder_text = "Hostname or IP-address"
+ self.fields['host_from'].widget.attrs.update({"placeholder": placeholder_text})
+ self.fields['host_to'].widget.attrs.update({"placeholder": placeholder_text})
- self.helper = FormHelper()
- self.helper.form_action = ""
- self.helper.form_method = 'GET'
-
- self.helper.layout = Layout(
- Row(
- Column(
- Field('host_from', placeholder=placeholder_text),
- css_class='medium-6',
- ),
- Column(
- Field('host_to', placeholder=placeholder_text), css_class='medium-6'
+ self.attrs = set_flat_form_attributes(
+ form_method='get',
+ form_fields=[
+ FormRow(
+ fields=[
+ FormColumn(fields=[self['host_from']], css_classes='medium-6'),
+ FormColumn(fields=[self['host_to']], css_classes='medium-6'),
+ ]
),
- ),
- Submit('submit', 'Trace'),
+ SubmitField(value='Trace'),
+ ],
)
def clean(self):
diff --git a/python/nav/web/templates/l2trace/l2trace.html b/python/nav/web/templates/l2trace/l2trace.html
index 04a0c8b776..0d48b7e51c 100644
--- a/python/nav/web/templates/l2trace/l2trace.html
+++ b/python/nav/web/templates/l2trace/l2trace.html
@@ -1,5 +1,4 @@
{% extends "base.html" %}
-{% load crispy_forms_tags %}
{% load tools %}
@@ -13,7 +12,7 @@
- {% crispy form %}
+ {% include 'custom_crispy_templates/flat_form.html' %}