Skip to content

Commit

Permalink
Handle case of no in progress records
Browse files Browse the repository at this point in the history
  • Loading branch information
alukach committed Oct 12, 2023
1 parent 0953f8b commit 81e86ec
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion app/admin_ui/views/v2.py
Original file line number Diff line number Diff line change
Expand Up @@ -225,12 +225,17 @@ def get_object(self, queryset=None):
queryset = self.queryset

canonical_uuid = self.kwargs["canonical_uuid"]
return (
obj = (
queryset.filter(Q(uuid=canonical_uuid) | Q(model_instance_uuid=canonical_uuid))
.order_by('status')
.first()
)

if not obj:
raise Http404(f'No in progress draft with Canonical UUID {canonical_uuid!r}')

return obj

def get_success_url(self, **kwargs):
url = reverse(
"canonical-redirect",
Expand Down

0 comments on commit 81e86ec

Please sign in to comment.