Skip to content

Commit

Permalink
Uncrispify management profile forms in seedDB
Browse files Browse the repository at this point in the history
  • Loading branch information
johannaengland committed Oct 8, 2024
1 parent fb52d6a commit 8e30f5b
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
4 changes: 4 additions & 0 deletions python/nav/web/seeddb/page/management_profile/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,8 @@ def __init__(self, *args, **kwargs):
if field in cfg:
self.fields[field].initial = cfg.get(field)

self.attrs = set_flat_form_attributes()

def _post_clean(self):
super(ProtocolSpecificMixIn, self)._post_clean()
cfg = self.instance.configuration
Expand Down Expand Up @@ -293,6 +295,8 @@ class Meta(object):
def __init__(self, *args, **kwargs):
super(ManagementProfileForm, self).__init__(*args, **kwargs)

self.attrs = set_flat_form_attributes()

def get_protocol_form_class(self):
"""Returns the protocol-specific form class that corresponds with the selected
management protocol of this profile.
Expand Down
13 changes: 10 additions & 3 deletions python/nav/web/templates/seeddb/management-profile/edit.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
{% extends "seeddb/base.html" %}
{% load crispy_forms_tags %}
{% block content %}

<p><a href="{{ back_url }}">Back to list</a></p>
Expand Down Expand Up @@ -27,7 +26,11 @@ <h4>Add new management profile</h4>
<div class="columns large-4">
<fieldset>
<legend>Basic profile data</legend>
{{ form | crispy }}
{% if form.attrs %}
{% include 'custom_crispy_templates/_form_content.html' %}
{% else %}
{{ form }}
{% endif %}
</fieldset>
</div>

Expand All @@ -38,7 +41,11 @@ <h4>Add new management profile</h4>
{% if form.NOTABENE %}
<div class="alert-box warning with-icon">{{ form.NOTABENE }}</div>
{% endif %}
{{ form | crispy }}
{% if form.attrs %}
{% include 'custom_crispy_templates/_form_content.html' %}
{% else %}
{{ form }}
{% endif %}
</fieldset>
{% endfor %}
</div>
Expand Down

0 comments on commit 8e30f5b

Please sign in to comment.