mirror of
https://github.com/netbox-community/netbox.git
synced 2024-05-10 07:54:54 +00:00
Extend VLAN group assignment form
This commit is contained in:
@ -1263,11 +1263,46 @@ class VLANForm(BootstrapMixin, TenancyForm, CustomFieldModelForm):
|
|||||||
'group_id': '$site_group',
|
'group_id': '$site_group',
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
location = DynamicModelChoiceField(
|
||||||
|
queryset=Location.objects.all(),
|
||||||
|
required=False,
|
||||||
|
null_option='None',
|
||||||
|
query_params={
|
||||||
|
'site_id': '$site',
|
||||||
|
}
|
||||||
|
)
|
||||||
|
rack = DynamicModelChoiceField(
|
||||||
|
queryset=Rack.objects.all(),
|
||||||
|
required=False,
|
||||||
|
null_option='None',
|
||||||
|
query_params={
|
||||||
|
'site_id': '$site',
|
||||||
|
'location_id': '$location',
|
||||||
|
}
|
||||||
|
)
|
||||||
|
group_scope = forms.ChoiceField(
|
||||||
|
choices=(
|
||||||
|
('', ''),
|
||||||
|
('dcim.region', 'Region'),
|
||||||
|
('dcim.sitegroup', 'Site group'),
|
||||||
|
('dcim.site', 'Site'),
|
||||||
|
('dcim.location', 'Location'),
|
||||||
|
('dcim.rack', 'Rack'),
|
||||||
|
),
|
||||||
|
required=False,
|
||||||
|
widget=StaticSelect2,
|
||||||
|
label='Group scope'
|
||||||
|
)
|
||||||
group = DynamicModelChoiceField(
|
group = DynamicModelChoiceField(
|
||||||
queryset=VLANGroup.objects.all(),
|
queryset=VLANGroup.objects.all(),
|
||||||
required=False,
|
required=False,
|
||||||
query_params={
|
query_params={
|
||||||
'site_id': '$site'
|
'scope_type': '$group_scope',
|
||||||
|
'region': '$region',
|
||||||
|
'sitegroup': '$site_group',
|
||||||
|
'site': '$site',
|
||||||
|
'location': '$location',
|
||||||
|
'rack': '$rack',
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
role = DynamicModelChoiceField(
|
role = DynamicModelChoiceField(
|
||||||
@ -1286,7 +1321,7 @@ class VLANForm(BootstrapMixin, TenancyForm, CustomFieldModelForm):
|
|||||||
]
|
]
|
||||||
fieldsets = (
|
fieldsets = (
|
||||||
('VLAN', ('vid', 'name', 'status', 'role', 'description', 'tags')),
|
('VLAN', ('vid', 'name', 'status', 'role', 'description', 'tags')),
|
||||||
('Assignment', ('region', 'site_group', 'site', 'group')),
|
('Assignment', ('region', 'site_group', 'site', 'location', 'rack', 'group_scope', 'group')),
|
||||||
('Tenancy', ('tenant_group', 'tenant')),
|
('Tenancy', ('tenant_group', 'tenant')),
|
||||||
)
|
)
|
||||||
help_texts = {
|
help_texts = {
|
||||||
|
Reference in New Issue
Block a user