From 6e3ace3eaea87609d91af147127f4ef57920e9fe Mon Sep 17 00:00:00 2001 From: Johanna England Date: Wed, 9 Oct 2024 16:03:37 +0200 Subject: [PATCH] Uncrispify seedDB --- python/nav/web/seeddb/forms/__init__.py | 2 +- .../nav/web/seeddb/page/management_profile/forms.py | 1 + python/nav/web/templates/seeddb/edit.html | 10 +--------- python/nav/web/templates/seeddb/edit_prefix.html | 7 +------ python/nav/web/templates/seeddb/list.html | 11 +---------- .../templates/seeddb/management-profile/edit.html | 12 ++---------- .../web/templates/seeddb/service_netbox_form.html | 6 +----- .../web/templates/seeddb/service_property_form.html | 12 ++---------- 8 files changed, 10 insertions(+), 51 deletions(-) diff --git a/python/nav/web/seeddb/forms/__init__.py b/python/nav/web/seeddb/forms/__init__.py index 4ae917523a..8db9aaa7f1 100644 --- a/python/nav/web/seeddb/forms/__init__.py +++ b/python/nav/web/seeddb/forms/__init__.py @@ -126,7 +126,7 @@ def cut_branch(field, klass, pk): return [c for c in field.choices if c[0] not in descendant_ids] -# non-crispy helpers +# helpers def get_single_layout(heading, row): diff --git a/python/nav/web/seeddb/page/management_profile/forms.py b/python/nav/web/seeddb/page/management_profile/forms.py index 5073c30b1b..0c34a95db1 100644 --- a/python/nav/web/seeddb/page/management_profile/forms.py +++ b/python/nav/web/seeddb/page/management_profile/forms.py @@ -16,6 +16,7 @@ from django import forms from nav.models.manage import ManagementProfile +from nav.web.crispyforms import set_flat_form_attributes from nav.web.seeddb.forms import get_single_layout PROTOCOL_CHOICES = dict(ManagementProfile.PROTOCOL_CHOICES) diff --git a/python/nav/web/templates/seeddb/edit.html b/python/nav/web/templates/seeddb/edit.html index 4022b9fe69..229eb4dd0e 100644 --- a/python/nav/web/templates/seeddb/edit.html +++ b/python/nav/web/templates/seeddb/edit.html @@ -1,6 +1,4 @@ {% extends "seeddb/base.html" %} -{% load crispy_forms_tags %} - {% block base_header_additional_head %} {{ block.super }} @@ -41,13 +39,7 @@

{{ title }}
Attributes - {% if form.attrs %} - {% include 'custom_crispy_templates/_form_content.html' %} - {% else %} - {% block crispyfields %} - {{ form|crispy }} - {% endblock %} - {% endif %} + {% include 'custom_crispy_templates/_form_content.html' %}
diff --git a/python/nav/web/templates/seeddb/edit_prefix.html b/python/nav/web/templates/seeddb/edit_prefix.html index 34e22cb12b..1c81a208fc 100644 --- a/python/nav/web/templates/seeddb/edit_prefix.html +++ b/python/nav/web/templates/seeddb/edit_prefix.html @@ -1,10 +1,5 @@ {% extends "seeddb/edit.html" %} -{% load crispy_forms_tags %} {% block crispyfields %} {{ block.super }} -{% if vlan_form.attrs %} - {% include 'custom_crispy_templates/_form_content.html' with form=vlan_form %} -{% else %} - {{ vlan_form }} -{% endif %} +{% include 'custom_crispy_templates/_form_content.html' with form=vlan_form %} {% endblock %} diff --git a/python/nav/web/templates/seeddb/list.html b/python/nav/web/templates/seeddb/list.html index d1ff5bc3ca..f286f4a9a4 100644 --- a/python/nav/web/templates/seeddb/list.html +++ b/python/nav/web/templates/seeddb/list.html @@ -1,23 +1,14 @@ {% extends "seeddb/base.html" %} -{% load crispy_forms_tags %} {% block content %} {% if filter_form %} {% if filter_form.base_fields|length >= 3 %} - {% if filter_form.attrs %} - {% include 'custom_crispy_templates/flat_form.html' with form=filter_form %} - {% else %} - {{ filter_form }} - {% endif %} + {% include 'custom_crispy_templates/flat_form.html' with form=filter_form %} {% else %}
- {% if filter_form.attrs %} {% include 'custom_crispy_templates/flat_form.html' with form=filter_form %} - {% else %} - {% crispy filter_form %} - {% endif %}
{% endif %} diff --git a/python/nav/web/templates/seeddb/management-profile/edit.html b/python/nav/web/templates/seeddb/management-profile/edit.html index 411ccd0bfa..b30c914720 100644 --- a/python/nav/web/templates/seeddb/management-profile/edit.html +++ b/python/nav/web/templates/seeddb/management-profile/edit.html @@ -26,11 +26,7 @@

Add new management profile

Basic profile data - {% if form.attrs %} - {% include 'custom_crispy_templates/_form_content.html' %} - {% else %} - {{ form }} - {% endif %} + {% include 'custom_crispy_templates/_form_content.html' %}
@@ -41,11 +37,7 @@

Add new management profile

{% if form.NOTABENE %}
{{ form.NOTABENE }}
{% endif %} - {% if form.attrs %} - {% include 'custom_crispy_templates/_form_content.html' %} - {% else %} - {{ form }} - {% endif %} + {% include 'custom_crispy_templates/_form_content.html' %} {% endfor %} diff --git a/python/nav/web/templates/seeddb/service_netbox_form.html b/python/nav/web/templates/seeddb/service_netbox_form.html index a2024f9c1f..72c6059000 100644 --- a/python/nav/web/templates/seeddb/service_netbox_form.html +++ b/python/nav/web/templates/seeddb/service_netbox_form.html @@ -15,11 +15,7 @@

Add new service checker - {% if choice_form.attrs %} - {% include 'custom_crispy_templates/_form_content.html' with form=choice_form %} - {% else %} - {{ choice_form }} - {% endif %} + {% include 'custom_crispy_templates/_form_content.html' with form=choice_form %}
diff --git a/python/nav/web/templates/seeddb/service_property_form.html b/python/nav/web/templates/seeddb/service_property_form.html index 4c9c50bfe1..b93706168b 100644 --- a/python/nav/web/templates/seeddb/service_property_form.html +++ b/python/nav/web/templates/seeddb/service_property_form.html @@ -19,17 +19,9 @@

Attributes - {% if service_form.attrs %} - {% include 'custom_crispy_templates/_form_content.html' with form=service_form %} - {% else %} - {{ service_form }} - {% endif %} + {% include 'custom_crispy_templates/_form_content.html' with form=service_form %} {% if property_form.fields %} - {% if property_form.attrs %} - {% include 'custom_crispy_templates/_form_content.html' with form=property_form %} - {% else %} - {{ property_form }} - {% endif %} + {% include 'custom_crispy_templates/_form_content.html' with form=property_form %} {% else %}
There are no attributes for this service.