Skip to content

Commit

Permalink
'Refactored by Sourcery'
Browse files Browse the repository at this point in the history
  • Loading branch information
Sourcery AI committed Jan 30, 2023
1 parent ced12c5 commit 0922581
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions netbox_acls/forms/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -490,20 +490,19 @@ def _check_if_interface_already_has_acl_in_direction(self, assigned_object_id, a
"""
Check that the interface does not have an existing ACL applied in the direction already.
"""
if ACLInterfaceAssignment.objects.filter(
if not ACLInterfaceAssignment.objects.filter(
assigned_object_id=assigned_object_id,
assigned_object_type=assigned_object_type_id,
direction=direction,
).exists():
error_interface_already_assigned = (
"Interfaces can only have 1 Access List assigned in each direction."
)
return {
"direction": [error_interface_already_assigned],
assigned_object_type: [error_interface_already_assigned],
}
else:
return {}
error_interface_already_assigned = (
"Interfaces can only have 1 Access List assigned in each direction."
)
return {
"direction": [error_interface_already_assigned],
assigned_object_type: [error_interface_already_assigned],
}


def save(self, *args, **kwargs):
Expand Down

0 comments on commit 0922581

Please sign in to comment.