Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Uncrispify ManualDetentionForm #3171

Merged
merged 1 commit into from
Nov 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading