Skip to content

Commit

Permalink
Uncrispify ManualDetentionForm
Browse files Browse the repository at this point in the history
  • Loading branch information
stveit committed Nov 13, 2024
1 parent 842754e commit 19a9ad2
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 14 deletions.
28 changes: 16 additions & 12 deletions python/nav/web/arnold/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
CheckBox,
FlatFieldset,
FormColumn,
FormDiv,
FormRow,
SubmitField,
set_flat_form_attributes,
Expand Down Expand Up @@ -302,22 +303,25 @@ def clean(self):
return cleaned_data

def __init__(self, *args, **kwargs):
self.helper = FormHelper()
self.helper.form_tag = False
self.helper.layout = Layout(
'target',
'method',
Div('qvlan', css_class='qvlanrow'),
'justification',
'comment',
'days',
Submit('submit', 'Detain'),
)

super(ManualDetentionForm, self).__init__(*args, **kwargs)
self.fields['justification'].choices = get_justifications()
self.fields['qvlan'].choices = get_quarantine_vlans()

self.attrs = set_flat_form_attributes(
form_fields=[
self['target'],
self['method'],
FormDiv(
fields=[self['qvlan']],
css_classes='qvlanrow',
),
self['justification'],
self['comment'],
self['days'],
],
submit_field=SubmitField(value='Detain'),
)


def get_justifications(profileid=None):
"""Return list of justifications ready for use as choices in forms
Expand Down
3 changes: 1 addition & 2 deletions python/nav/web/templates/arnold/manualdetain-step2.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
{% extends 'arnold/base.html' %}
{% load crispy_forms_tags %}

{% load info %}

Expand Down Expand Up @@ -68,7 +67,7 @@
</div>

{# Display form for setting detention choices. #}
{% crispy form %}
{% include 'custom_crispy_templates/_form_content.html' %}
</fieldset>
</form>
</div> {# formcontainer #}
Expand Down

0 comments on commit 19a9ad2

Please sign in to comment.