Skip to content

Commit fe0ae39

Browse files
Closes: #17871 - Add cluster on bulkedit device (#17920)
* 17871 add cluster on bulkedit device * Make cluster assignment nullable; reorder imports --------- Co-authored-by: Jeremy Stretch <[email protected]>
1 parent f873735 commit fe0ae39

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

netbox/dcim/forms/bulk_edit.py

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,9 @@
1515
from utilities.forms.fields import ColorField, CommentField, DynamicModelChoiceField, DynamicModelMultipleChoiceField
1616
from utilities.forms.rendering import FieldSet, InlineFields, TabbedGroups
1717
from utilities.forms.widgets import BulkEditNullBooleanSelect, NumberWithOptions
18-
from wireless.models import WirelessLAN, WirelessLANGroup
18+
from virtualization.models import Cluster
1919
from wireless.choices import WirelessRoleChoices
20+
from wireless.models import WirelessLAN, WirelessLANGroup
2021

2122
__all__ = (
2223
'CableBulkEditForm',
@@ -721,6 +722,14 @@ class DeviceBulkEditForm(NetBoxModelBulkEditForm):
721722
queryset=ConfigTemplate.objects.all(),
722723
required=False
723724
)
725+
cluster = DynamicModelChoiceField(
726+
label=_('Cluster'),
727+
queryset=Cluster.objects.all(),
728+
required=False,
729+
query_params={
730+
'site_id': ['$site', 'null']
731+
},
732+
)
724733
comments = CommentField()
725734

726735
model = Device
@@ -729,9 +738,10 @@ class DeviceBulkEditForm(NetBoxModelBulkEditForm):
729738
FieldSet('site', 'location', name=_('Location')),
730739
FieldSet('manufacturer', 'device_type', 'airflow', 'serial', name=_('Hardware')),
731740
FieldSet('config_template', name=_('Configuration')),
741+
FieldSet('cluster', name=_('Virtualization')),
732742
)
733743
nullable_fields = (
734-
'location', 'tenant', 'platform', 'serial', 'airflow', 'description', 'comments',
744+
'location', 'tenant', 'platform', 'serial', 'airflow', 'description', 'cluster', 'comments',
735745
)
736746

737747

0 commit comments

Comments
 (0)