Skip to content

Commit

Permalink
tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
ryanmerolle committed Jan 28, 2023
1 parent c21b4c7 commit 1dbe0b7
Showing 1 changed file with 14 additions and 14 deletions.
28 changes: 14 additions & 14 deletions netbox_acls/forms/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ def get_host_types(self):

def validate_host_types(self, host_types):
"""
Check if more than one host type selected.
Check number of host types selected.
"""
if len(host_types) > 1:
raise forms.ValidationError(
Expand Down Expand Up @@ -434,19 +434,19 @@ def clean(self):
assigned_object_type: [error_acl_not_assigned_to_host],
host_type: [error_acl_not_assigned_to_host],
}
## Check for duplicate entry.
# if ACLInterfaceAssignment.objects.filter(
# access_list=access_list,
# assigned_object_id=assigned_object_id,
# assigned_object_type=assigned_object_type_id,
# direction=direction,
# ).exists():
# error_duplicate_entry = "An ACL with this name is already associated to this interface & direction."
# error_message |= {
# "access_list": [error_duplicate_entry],
# "direction": [error_duplicate_entry],
# assigned_object_type: [error_duplicate_entry],
# }
# Check for duplicate entry.
if ACLInterfaceAssignment.objects.filter(
access_list=access_list,
assigned_object_id=assigned_object_id,
assigned_object_type=assigned_object_type_id,
direction=direction,
).exists():
error_duplicate_entry = "An ACL with this name is already associated to this interface & direction."
error_message |= {
"access_list": [error_duplicate_entry],
"direction": [error_duplicate_entry],
assigned_object_type: [error_duplicate_entry],
}
# Check that the interface does not have an existing ACL applied in the direction already.
if ACLInterfaceAssignment.objects.filter(
assigned_object_id=assigned_object_id,
Expand Down

0 comments on commit 1dbe0b7

Please sign in to comment.