mirror of
https://github.com/netbox-community/netbox.git
synced 2025-07-14 09:51:22 -06:00
Fix Tests
This commit is contained in:
parent
22e320084a
commit
bec97df242
@ -1534,15 +1534,16 @@ class MACAddress(PrimaryModel):
|
||||
def clean(self, *args, **kwargs):
|
||||
super().clean()
|
||||
if self._original_assigned_object_id and self._original_assigned_object_type_id:
|
||||
assigned_object = getattr(self.assigned_object, 'parent_object', None)
|
||||
assigned_object = self.assigned_object
|
||||
ct = ObjectType.objects.get_for_id(self._original_assigned_object_type_id)
|
||||
original_assigned_object = ct.get_object_for_this_type(pk=self._original_assigned_object_id)
|
||||
|
||||
if original_assigned_object and not assigned_object:
|
||||
if original_assigned_object.primary_mac_address:
|
||||
if not assigned_object:
|
||||
raise ValidationError(
|
||||
_("Cannot unassign MAC Address while it is designated as the primary MAC for an object")
|
||||
)
|
||||
elif original_assigned_object and original_assigned_object != assigned_object:
|
||||
elif original_assigned_object != assigned_object:
|
||||
raise ValidationError(
|
||||
_("Cannot reassign MAC Address while it is designated as the primary MAC for an object")
|
||||
)
|
||||
|
Loading…
Reference in New Issue
Block a user