Skip to content

Commit

Permalink
api: Fix bug in OrgDetail for non-existent Org
Browse files Browse the repository at this point in the history
The OrgDetail view wasn't properly handling object-not-found errors.
  • Loading branch information
R2ZER0 committed Feb 22, 2024
1 parent 5d55897 commit 5517d78
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions datastore/api/org/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,14 +72,15 @@ def get_object(self):
db.Publisher.objects.filter(getter_run__in=db.GetterRun.objects.in_use())
)

organisation = models.Organisation.get(
org_id,
funder_queryset=funder_queryset,
recipient_queryset=recipient_queryset,
publisher_queryset=publisher_queryset,
)

if not organisation:
try:
organisation = models.Organisation.get(
org_id,
funder_queryset=funder_queryset,
recipient_queryset=recipient_queryset,
publisher_queryset=publisher_queryset,
)

except models.Organisation.DoesNotExist:
raise Http404

return organisation
Expand Down

0 comments on commit 5517d78

Please sign in to comment.