mirror of
https://github.com/netbox-community/netbox.git
synced 2025-07-23 04:22:01 -06:00
Move vlan_translation_policy fields to model and filterset mixins
This commit is contained in:
parent
3861e5b5ef
commit
5da38ec5db
@ -1629,6 +1629,17 @@ class CommonInterfaceFilterSet(django_filters.FilterSet):
|
||||
to_field_name='identifier',
|
||||
label=_('L2VPN'),
|
||||
)
|
||||
vlan_translation_policy_id = django_filters.ModelMultipleChoiceFilter(
|
||||
field_name='vlan_translation_policy',
|
||||
queryset=VLANTranslationPolicy.objects.all(),
|
||||
label=_('VLAN Translation Policy (ID)'),
|
||||
)
|
||||
vlan_translation_policy = django_filters.ModelMultipleChoiceFilter(
|
||||
field_name='vlan_translation_policy__name',
|
||||
queryset=VLANTranslationPolicy.objects.all(),
|
||||
to_field_name='name',
|
||||
label=_('VLAN Translation Policy'),
|
||||
)
|
||||
|
||||
def filter_vlan_id(self, queryset, name, value):
|
||||
value = value.strip()
|
||||
@ -1733,17 +1744,6 @@ class InterfaceFilterSet(
|
||||
queryset=WirelessLink.objects.all(),
|
||||
label=_('Wireless link')
|
||||
)
|
||||
vlan_translation_policy_id = django_filters.ModelMultipleChoiceFilter(
|
||||
field_name='vlan_translation_policy',
|
||||
queryset=VLANTranslationPolicy.objects.all(),
|
||||
label=_('VLAN Translation Policy (ID)'),
|
||||
)
|
||||
vlan_translation_policy = django_filters.ModelMultipleChoiceFilter(
|
||||
field_name='vlan_translation_policy__name',
|
||||
queryset=VLANTranslationPolicy.objects.all(),
|
||||
to_field_name='name',
|
||||
label=_('VLAN Translation Policy'),
|
||||
)
|
||||
|
||||
class Meta:
|
||||
model = Interface
|
||||
|
@ -540,6 +540,13 @@ class BaseInterface(models.Model):
|
||||
blank=True,
|
||||
verbose_name=_('bridge interface')
|
||||
)
|
||||
vlan_translation_policy = models.ForeignKey(
|
||||
to='ipam.VLANTranslationPolicy',
|
||||
on_delete=models.SET_NULL,
|
||||
null=True,
|
||||
blank=True,
|
||||
verbose_name=_('VLAN Translation Policy'),
|
||||
)
|
||||
|
||||
class Meta:
|
||||
abstract = True
|
||||
@ -725,13 +732,6 @@ class Interface(ModularComponentModel, BaseInterface, CabledObjectModel, PathEnd
|
||||
object_id_field='assigned_object_id',
|
||||
related_query_name='interface',
|
||||
)
|
||||
vlan_translation_policy = models.ForeignKey(
|
||||
to='ipam.VLANTranslationPolicy',
|
||||
on_delete=models.SET_NULL,
|
||||
null=True,
|
||||
blank=True,
|
||||
verbose_name=_('VLAN Translation Policy'),
|
||||
)
|
||||
|
||||
clone_fields = (
|
||||
'device', 'module', 'parent', 'bridge', 'lag', 'type', 'mgmt_only', 'mtu', 'mode', 'speed', 'duplex', 'rf_role',
|
||||
|
@ -7,7 +7,6 @@ from dcim.models import Device, DeviceRole, Platform, Region, Site, SiteGroup
|
||||
from extras.filtersets import LocalConfigContextFilterSet
|
||||
from extras.models import ConfigTemplate
|
||||
from ipam.filtersets import PrimaryIPFilterSet
|
||||
from ipam.models import VLANTranslationPolicy
|
||||
from netbox.filtersets import OrganizationalModelFilterSet, NetBoxModelFilterSet
|
||||
from tenancy.filtersets import TenancyFilterSet, ContactModelFilterSet
|
||||
from utilities.filters import MultiValueCharFilter, MultiValueMACAddressFilter, TreeNodeMultipleChoiceFilter
|
||||
@ -301,17 +300,6 @@ class VMInterfaceFilterSet(NetBoxModelFilterSet, CommonInterfaceFilterSet):
|
||||
mac_address = MultiValueMACAddressFilter(
|
||||
label=_('MAC address'),
|
||||
)
|
||||
vlan_translation_policy_id = django_filters.ModelMultipleChoiceFilter(
|
||||
field_name='vlan_translation_policy',
|
||||
queryset=VLANTranslationPolicy.objects.all(),
|
||||
label=_('VLAN Translation Policy (ID)'),
|
||||
)
|
||||
vlan_translation_policy = django_filters.ModelMultipleChoiceFilter(
|
||||
field_name='vlan_translation_policy__name',
|
||||
queryset=VLANTranslationPolicy.objects.all(),
|
||||
to_field_name='name',
|
||||
label=_('VLAN Translation Policy (name)'),
|
||||
)
|
||||
|
||||
class Meta:
|
||||
model = VMInterface
|
||||
|
@ -368,13 +368,6 @@ class VMInterface(ComponentModel, BaseInterface, TrackingModelMixin):
|
||||
object_id_field='assigned_object_id',
|
||||
related_query_name='vminterface',
|
||||
)
|
||||
vlan_translation_policy = models.ForeignKey(
|
||||
to='ipam.VLANTranslationPolicy',
|
||||
on_delete=models.SET_NULL,
|
||||
null=True,
|
||||
blank=True,
|
||||
verbose_name=_('VLAN Translation Policy'),
|
||||
)
|
||||
|
||||
class Meta(ComponentModel.Meta):
|
||||
verbose_name = _('interface')
|
||||
|
Loading…
Reference in New Issue
Block a user