mirror of
https://github.com/netbox-community/netbox.git
synced 2025-07-29 20:06:25 -06:00
Style cleanup
This commit is contained in:
parent
563caa9af8
commit
3d244bfa37
@ -1627,7 +1627,7 @@ class MACAddressFilterSet(NetBoxModelFilterSet):
|
||||
|
||||
class Meta:
|
||||
model = MACAddress
|
||||
fields = ('id', 'description', 'interface', 'assigned_object_type', 'assigned_object_id')
|
||||
fields = ('id', 'description', 'is_primary', 'assigned_object_type', 'assigned_object_id')
|
||||
|
||||
def search(self, queryset, name, value):
|
||||
if not value.strip():
|
||||
|
@ -1289,7 +1289,6 @@ class MACAddressBulkEditForm(NetBoxModelBulkEditForm):
|
||||
model = MACAddress
|
||||
fieldsets = (
|
||||
FieldSet('description'),
|
||||
# FieldSet('vrf', 'mask_length', 'dns_name', name=_('Addressing')),
|
||||
)
|
||||
nullable_fields = (
|
||||
'description', 'comments',
|
||||
|
@ -1519,7 +1519,7 @@ class MACAddress(PrimaryModel):
|
||||
super().clean()
|
||||
|
||||
if self.is_primary and self.assigned_object:
|
||||
if self.assigned_object.mac_addresses.filter(is_primary=True).exists():
|
||||
if self.assigned_object.mac_addresses.filter(is_primary=True).exclude(pk=self.pk).exists():
|
||||
raise ValidationError({
|
||||
'is_primary': _("There is already a primary MAC address for this interface.")
|
||||
})
|
||||
|
@ -9,7 +9,7 @@ from extras.models import ConfigTemplate
|
||||
from ipam.filtersets import PrimaryIPFilterSet
|
||||
from netbox.filtersets import OrganizationalModelFilterSet, NetBoxModelFilterSet
|
||||
from tenancy.filtersets import TenancyFilterSet, ContactModelFilterSet
|
||||
from utilities.filters import MultiValueCharFilter, TreeNodeMultipleChoiceFilter, MultiValueMACAddressFilter
|
||||
from utilities.filters import MultiValueCharFilter, MultiValueMACAddressFilter, TreeNodeMultipleChoiceFilter
|
||||
from .choices import *
|
||||
from .models import *
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user