Skip to content

Commit 1dbe0b7

Browse files
committed
tweaks
1 parent c21b4c7 commit 1dbe0b7

File tree

1 file changed

+14
-14
lines changed

1 file changed

+14
-14
lines changed

netbox_acls/forms/models.py

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ def get_host_types(self):
214214

215215
def validate_host_types(self, host_types):
216216
"""
217-
Check if more than one host type selected.
217+
Check number of host types selected.
218218
"""
219219
if len(host_types) > 1:
220220
raise forms.ValidationError(
@@ -434,19 +434,19 @@ def clean(self):
434434
assigned_object_type: [error_acl_not_assigned_to_host],
435435
host_type: [error_acl_not_assigned_to_host],
436436
}
437-
## Check for duplicate entry.
438-
# if ACLInterfaceAssignment.objects.filter(
439-
# access_list=access_list,
440-
# assigned_object_id=assigned_object_id,
441-
# assigned_object_type=assigned_object_type_id,
442-
# direction=direction,
443-
# ).exists():
444-
# error_duplicate_entry = "An ACL with this name is already associated to this interface & direction."
445-
# error_message |= {
446-
# "access_list": [error_duplicate_entry],
447-
# "direction": [error_duplicate_entry],
448-
# assigned_object_type: [error_duplicate_entry],
449-
# }
437+
# Check for duplicate entry.
438+
if ACLInterfaceAssignment.objects.filter(
439+
access_list=access_list,
440+
assigned_object_id=assigned_object_id,
441+
assigned_object_type=assigned_object_type_id,
442+
direction=direction,
443+
).exists():
444+
error_duplicate_entry = "An ACL with this name is already associated to this interface & direction."
445+
error_message |= {
446+
"access_list": [error_duplicate_entry],
447+
"direction": [error_duplicate_entry],
448+
assigned_object_type: [error_duplicate_entry],
449+
}
450450
# Check that the interface does not have an existing ACL applied in the direction already.
451451
if ACLInterfaceAssignment.objects.filter(
452452
assigned_object_id=assigned_object_id,

0 commit comments

Comments
 (0)