Skip to content

Commit

Permalink
Merge pull request Uninett#3138 from Uninett/refactor/uncrispify-acco…
Browse files Browse the repository at this point in the history
…unt-group-form-useradmin

Uncrispify AccountGroupForm in useradmin
  • Loading branch information
johannaengland authored Nov 7, 2024
2 parents f74ddf0 + 94c1deb commit bd19836
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 12 deletions.
3 changes: 1 addition & 2 deletions python/nav/web/templates/useradmin/group_detail.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
{% extends "useradmin/base.html" %}
{% load crispy_forms_tags %}

{% block base_header_additional_head %}
{{ block.super }}
Expand Down Expand Up @@ -41,7 +40,7 @@ <h4>Create new group</h4>
{# GROUP FORM #}
<div class="column medium-6 large-3">
{% if group_form %}
{% crispy group_form %}
{% include 'custom_crispy_templates/flat_form.html' with form=group_form %}
{% endif %}
</div>

Expand Down
26 changes: 16 additions & 10 deletions python/nav/web/useradmin/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,16 +54,22 @@ class AccountGroupForm(forms.ModelForm):

def __init__(self, *args, **kwargs):
super(AccountGroupForm, self).__init__(*args, **kwargs)
self.helper = FormHelper()
self.helper.form_action = ''
self.helper.form_method = 'post'
self.helper.layout = Layout(
Fieldset(
'Group info',
'name',
'description',
Submit('submit_group', 'Save changes', css_class='small'),
)

self.attrs = set_flat_form_attributes(
form_fields=[
FlatFieldset(
legend="Group info",
fields=[
self["name"],
self["description"],
SubmitField(
name="submit_group",
value="Save changes",
css_classes="small",
),
],
)
]
)

class Meta(object):
Expand Down

0 comments on commit bd19836

Please sign in to comment.