Skip to content

Commit

Permalink
Closes: #17871 - Add cluster on bulkedit device (#17920)
Browse files Browse the repository at this point in the history
* 17871 add cluster on bulkedit device

* Make cluster assignment nullable; reorder imports

---------

Co-authored-by: Jeremy Stretch <[email protected]>
  • Loading branch information
pl0xym0r and jeremystretch authored Nov 7, 2024
1 parent f873735 commit fe0ae39
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions netbox/dcim/forms/bulk_edit.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,9 @@
from utilities.forms.fields import ColorField, CommentField, DynamicModelChoiceField, DynamicModelMultipleChoiceField
from utilities.forms.rendering import FieldSet, InlineFields, TabbedGroups
from utilities.forms.widgets import BulkEditNullBooleanSelect, NumberWithOptions
from wireless.models import WirelessLAN, WirelessLANGroup
from virtualization.models import Cluster
from wireless.choices import WirelessRoleChoices
from wireless.models import WirelessLAN, WirelessLANGroup

__all__ = (
'CableBulkEditForm',
Expand Down Expand Up @@ -721,6 +722,14 @@ class DeviceBulkEditForm(NetBoxModelBulkEditForm):
queryset=ConfigTemplate.objects.all(),
required=False
)
cluster = DynamicModelChoiceField(
label=_('Cluster'),
queryset=Cluster.objects.all(),
required=False,
query_params={
'site_id': ['$site', 'null']
},
)
comments = CommentField()

model = Device
Expand All @@ -729,9 +738,10 @@ class DeviceBulkEditForm(NetBoxModelBulkEditForm):
FieldSet('site', 'location', name=_('Location')),
FieldSet('manufacturer', 'device_type', 'airflow', 'serial', name=_('Hardware')),
FieldSet('config_template', name=_('Configuration')),
FieldSet('cluster', name=_('Virtualization')),
)
nullable_fields = (
'location', 'tenant', 'platform', 'serial', 'airflow', 'description', 'comments',
'location', 'tenant', 'platform', 'serial', 'airflow', 'description', 'cluster', 'comments',
)


Expand Down

0 comments on commit fe0ae39

Please sign in to comment.