Skip to content

Commit

Permalink
Endpoint get or create: Do not raise warning when there is an existin…
Browse files Browse the repository at this point in the history
…g endpoint

When a single endpoints is found in the endpoint get or create helper method, we do not want to raise a warning
  • Loading branch information
Maffooch committed Jul 10, 2024
1 parent 96e1d92 commit 6478598
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions dojo/endpoint/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,8 @@ def endpoint_get_or_create(**kwargs):
count = qs.count()
if count == 0:
return Endpoint.objects.get_or_create(**kwargs)
elif count == 1:
return qs.order_by("id").first(), False
else:
logger.warning(
f"Endpoints in your database are broken. "
Expand Down

0 comments on commit 6478598

Please sign in to comment.