mirror of
https://github.com/netbox-community/netbox.git
synced 2025-08-17 04:58:16 -06:00
Annotate parent object on relevant fields
This commit is contained in:
parent
7da211e67a
commit
a7ea105247
@ -557,6 +557,9 @@ class DeviceBulkEditForm(NetBoxModelBulkEditForm):
|
||||
label=_('Device type'),
|
||||
queryset=DeviceType.objects.all(),
|
||||
required=False,
|
||||
option_attrs={
|
||||
'parent': 'manufacturer',
|
||||
},
|
||||
query_params={
|
||||
'manufacturer_id': '$manufacturer'
|
||||
}
|
||||
@ -640,6 +643,9 @@ class ModuleBulkEditForm(NetBoxModelBulkEditForm):
|
||||
required=False,
|
||||
query_params={
|
||||
'manufacturer_id': '$manufacturer'
|
||||
},
|
||||
option_attrs={
|
||||
'parent': 'manufacturer',
|
||||
}
|
||||
)
|
||||
status = forms.ChoiceField(
|
||||
|
@ -434,6 +434,9 @@ class DeviceForm(TenancyForm, NetBoxModelForm):
|
||||
device_type = DynamicModelChoiceField(
|
||||
label=_('Device type'),
|
||||
queryset=DeviceType.objects.all(),
|
||||
option_attrs={
|
||||
'parent': 'manufacturer',
|
||||
},
|
||||
selector=True
|
||||
)
|
||||
role = DynamicModelChoiceField(
|
||||
@ -461,6 +464,9 @@ class DeviceForm(TenancyForm, NetBoxModelForm):
|
||||
label=_('Virtual chassis'),
|
||||
queryset=VirtualChassis.objects.all(),
|
||||
required=False,
|
||||
option_attrs={
|
||||
'parent': 'master',
|
||||
},
|
||||
selector=True
|
||||
)
|
||||
vc_position = forms.IntegerField(
|
||||
@ -568,6 +574,9 @@ class ModuleForm(ModuleCommonForm, NetBoxModelForm):
|
||||
module_type = DynamicModelChoiceField(
|
||||
label=_('Module type'),
|
||||
queryset=ModuleType.objects.all(),
|
||||
option_attrs={
|
||||
'parent': 'manufacturer',
|
||||
},
|
||||
selector=True
|
||||
)
|
||||
comments = CommentField()
|
||||
@ -774,7 +783,10 @@ class VCMemberSelectForm(forms.Form):
|
||||
class ComponentTemplateForm(forms.ModelForm):
|
||||
device_type = DynamicModelChoiceField(
|
||||
label=_('Device type'),
|
||||
queryset=DeviceType.objects.all()
|
||||
queryset=DeviceType.objects.all(),
|
||||
option_attrs={
|
||||
'parent': 'manufacturer',
|
||||
}
|
||||
)
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
@ -789,12 +801,18 @@ class ModularComponentTemplateForm(ComponentTemplateForm):
|
||||
device_type = DynamicModelChoiceField(
|
||||
label=_('Device type'),
|
||||
queryset=DeviceType.objects.all().all(),
|
||||
required=False
|
||||
required=False,
|
||||
option_attrs={
|
||||
'parent': 'manufacturer',
|
||||
}
|
||||
)
|
||||
module_type = DynamicModelChoiceField(
|
||||
label=_('Module type'),
|
||||
queryset=ModuleType.objects.all(),
|
||||
required=False
|
||||
required=False,
|
||||
option_attrs={
|
||||
'parent': 'manufacturer',
|
||||
}
|
||||
)
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
|
@ -267,14 +267,20 @@ class IPRangeForm(TenancyForm, NetBoxModelForm):
|
||||
|
||||
class IPAddressForm(TenancyForm, NetBoxModelForm):
|
||||
interface = DynamicModelChoiceField(
|
||||
label=_('Interface'),
|
||||
queryset=Interface.objects.all(),
|
||||
required=False,
|
||||
option_attrs={
|
||||
'parent': 'device',
|
||||
},
|
||||
selector=True,
|
||||
label=_('Interface'),
|
||||
)
|
||||
vminterface = DynamicModelChoiceField(
|
||||
queryset=VMInterface.objects.all(),
|
||||
required=False,
|
||||
option_attrs={
|
||||
'parent': 'virtual_machine',
|
||||
},
|
||||
selector=True,
|
||||
label=_('Interface'),
|
||||
)
|
||||
|
Loading…
Reference in New Issue
Block a user