mirror of
https://github.com/netbox-community/netbox.git
synced 2025-07-31 04:46:26 -06:00
9604 form bulk_edit
This commit is contained in:
parent
30c5fa8c7a
commit
8ba899d1c7
@ -197,10 +197,12 @@ class CircuitTerminationBulkEditForm(NetBoxModelBulkEditForm):
|
|||||||
max_length=200,
|
max_length=200,
|
||||||
required=False
|
required=False
|
||||||
)
|
)
|
||||||
site = DynamicModelChoiceField(
|
scope = DynamicModelChoiceField(
|
||||||
label=_('Site'),
|
label=_('Scope'),
|
||||||
queryset=Site.objects.all(),
|
queryset=Site.objects.none(), # Initial queryset
|
||||||
required=False
|
required=False,
|
||||||
|
disabled=True,
|
||||||
|
selector=True
|
||||||
)
|
)
|
||||||
provider_network = DynamicModelChoiceField(
|
provider_network = DynamicModelChoiceField(
|
||||||
label=_('Provider Network'),
|
label=_('Provider Network'),
|
||||||
@ -226,14 +228,28 @@ class CircuitTerminationBulkEditForm(NetBoxModelBulkEditForm):
|
|||||||
FieldSet(
|
FieldSet(
|
||||||
'description',
|
'description',
|
||||||
TabbedGroups(
|
TabbedGroups(
|
||||||
FieldSet('site', name=_('Site')),
|
FieldSet('scope_type', 'scope', name=_('Scope')),
|
||||||
FieldSet('provider_network', name=_('Provider Network')),
|
FieldSet('provider_network', name=_('Provider Network')),
|
||||||
),
|
),
|
||||||
'mark_connected', name=_('Circuit Termination')
|
'mark_connected', name=_('Circuit Termination')
|
||||||
),
|
),
|
||||||
FieldSet('port_speed', 'upstream_speed', name=_('Termination Details')),
|
FieldSet('port_speed', 'upstream_speed', name=_('Termination Details')),
|
||||||
)
|
)
|
||||||
nullable_fields = ('description')
|
nullable_fields = ('description', 'scope')
|
||||||
|
|
||||||
|
def __init__(self, *args, **kwargs):
|
||||||
|
super().__init__(*args, **kwargs)
|
||||||
|
|
||||||
|
if scope_type_id := get_field_value(self, 'scope_type'):
|
||||||
|
try:
|
||||||
|
scope_type = ContentType.objects.get(pk=scope_type_id)
|
||||||
|
model = scope_type.model_class()
|
||||||
|
self.fields['scope'].queryset = model.objects.all()
|
||||||
|
self.fields['scope'].widget.attrs['selector'] = model._meta.label_lower
|
||||||
|
self.fields['scope'].disabled = False
|
||||||
|
self.fields['scope'].label = _(bettertitle(model._meta.verbose_name))
|
||||||
|
except ObjectDoesNotExist:
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
class CircuitGroupBulkEditForm(NetBoxModelBulkEditForm):
|
class CircuitGroupBulkEditForm(NetBoxModelBulkEditForm):
|
||||||
|
Loading…
Reference in New Issue
Block a user