mirror of
https://github.com/netbox-community/netbox.git
synced 2025-07-31 04:46:26 -06:00
Define vlan_translation_table conditionally
This commit is contained in:
parent
722c7ba6af
commit
04fb92fa98
@ -2579,10 +2579,12 @@ class InterfaceView(generic.ObjectView):
|
|||||||
data=vlans,
|
data=vlans,
|
||||||
orderable=False
|
orderable=False
|
||||||
)
|
)
|
||||||
vlan_translation_table = VLANTranslationRuleTable(
|
vlan_translation_table = None
|
||||||
data=instance.vlan_translation_policy.rules.all() if instance.vlan_translation_policy else [],
|
if instance.vlan_translation_policy:
|
||||||
orderable=False
|
vlan_translation_table = VLANTranslationRuleTable(
|
||||||
)
|
data=instance.vlan_translation_policy.rules.all(),
|
||||||
|
orderable=False
|
||||||
|
)
|
||||||
|
|
||||||
return {
|
return {
|
||||||
'vdc_table': vdc_table,
|
'vdc_table': vdc_table,
|
||||||
|
@ -515,10 +515,12 @@ class VMInterfaceView(generic.ObjectView):
|
|||||||
exclude=('virtual_machine',),
|
exclude=('virtual_machine',),
|
||||||
orderable=False
|
orderable=False
|
||||||
)
|
)
|
||||||
vlan_translation_table = VLANTranslationRuleTable(
|
vlan_translation_table = None
|
||||||
data=instance.vlan_translation_policy.rules.all() if instance.vlan_translation_policy else [],
|
if instance.vlan_translation_policy:
|
||||||
orderable=False
|
vlan_translation_table = VLANTranslationRuleTable(
|
||||||
)
|
data=instance.vlan_translation_policy.rules.all(),
|
||||||
|
orderable=False
|
||||||
|
)
|
||||||
|
|
||||||
# Get assigned VLANs and annotate whether each is tagged or untagged
|
# Get assigned VLANs and annotate whether each is tagged or untagged
|
||||||
vlans = []
|
vlans = []
|
||||||
|
Loading…
Reference in New Issue
Block a user