Skip to content

Commit

Permalink
Use non-crispy DeviceGroupForm in seeddb
Browse files Browse the repository at this point in the history
  • Loading branch information
podliashanyk committed Sep 20, 2024
1 parent 927bb84 commit 25ce6c1
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 14 deletions.
11 changes: 3 additions & 8 deletions python/nav/web/seeddb/forms/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
from django.utils.safestring import mark_safe

from crispy_forms.helper import FormHelper
from crispy_forms_foundation.layout import Layout, Field, Fieldset, Row, Column
from crispy_forms_foundation.layout import Layout, Fieldset, Row, Column

from nav.django.forms import HStoreField
from nav.web.crispyforms import LabelSubmit
Expand Down Expand Up @@ -372,6 +372,8 @@ class DeviceGroupForm(forms.ModelForm):
netboxes = forms.ModelMultipleChoiceField(
queryset=Netbox.objects.all(), required=False
)
netboxes.widget.attrs.update({"class": "select2"})
no_crispy = True

def __init__(self, *args, **kwargs):
# If the form is based on an existing model instance, populate the
Expand All @@ -380,13 +382,6 @@ def __init__(self, *args, **kwargs):
initial = kwargs.setdefault('initial', {})
initial['netboxes'] = [n.pk for n in kwargs['instance'].netboxes.all()]
forms.ModelForm.__init__(self, *args, **kwargs)
self.helper = FormHelper()
self.helper.form_tag = False
self.helper.layout = Layout(
'id',
'description',
Field('netboxes', css_class='select2'),
)

class Meta(object):
model = NetboxGroup
Expand Down
1 change: 0 additions & 1 deletion python/nav/web/seeddb/page/netboxgroup.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,6 @@ def netboxgroup_edit(request, netboxgroup_id=None):
DeviceGroupForm,
netboxgroup_id,
'seeddb-netboxgroup-edit',
template='seeddb/edit_device_group.html',
extra_context=extra_context,
)

Expand Down
5 changes: 0 additions & 5 deletions python/nav/web/templates/seeddb/edit_device_group.html

This file was deleted.

0 comments on commit 25ce6c1

Please sign in to comment.