mirror of
https://github.com/netbox-community/netbox.git
synced 2026-03-09 16:00:10 +01:00
Compare commits
1 Commits
main
...
21611-repl
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
da9872d504 |
@@ -1529,8 +1529,11 @@ class CableImportForm(PrimaryModelImportForm):
|
||||
|
||||
model = content_type.model_class()
|
||||
try:
|
||||
if device.virtual_chassis and device.virtual_chassis.master == device and \
|
||||
model.objects.filter(device=device, name=name).count() == 0:
|
||||
if (
|
||||
device.virtual_chassis and
|
||||
device.virtual_chassis.master == device and
|
||||
not model.objects.filter(device=device, name=name).exists()
|
||||
):
|
||||
termination_object = model.objects.get(device__in=device.virtual_chassis.members.all(), name=name)
|
||||
else:
|
||||
termination_object = model.objects.get(device=device, name=name)
|
||||
|
||||
@@ -126,8 +126,8 @@ class L2VPNTermination(NetBoxModel):
|
||||
if self.assigned_object:
|
||||
obj_id = self.assigned_object.pk
|
||||
obj_type = ObjectType.objects.get_for_model(self.assigned_object)
|
||||
if L2VPNTermination.objects.filter(assigned_object_id=obj_id, assigned_object_type=obj_type).\
|
||||
exclude(pk=self.pk).count() > 0:
|
||||
terminations = L2VPNTermination.objects.filter(assigned_object_id=obj_id, assigned_object_type=obj_type)
|
||||
if terminations.exclude(pk=self.pk).exists():
|
||||
raise ValidationError(
|
||||
_('L2VPN Termination already assigned ({assigned_object})').format(
|
||||
assigned_object=self.assigned_object
|
||||
|
||||
Reference in New Issue
Block a user