Skip to content

Commit

Permalink
Fix Phase lookups
Browse files Browse the repository at this point in the history
  • Loading branch information
jmsmkn committed Jan 9, 2025
1 parent 7328639 commit 9ad7117
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions app/grandchallenge/evaluation/views/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -208,8 +208,8 @@ class PhaseUpdate(
queryset = Phase.objects.prefetch_related("optional_hanging_protocols")

def get_object(self, queryset=None):
return Phase.objects.get(
challenge=self.request.challenge, slug=self.kwargs["slug"]
return get_object_or_404(
Phase, challenge=self.request.challenge, slug=self.kwargs["slug"]
)

def get_form_kwargs(self):
Expand Down Expand Up @@ -325,8 +325,8 @@ def get_permission_object(self):

@cached_property
def phase(self):
return Phase.objects.get(
challenge=self.request.challenge, slug=self.kwargs["slug"]
return get_object_or_404(
Phase, challenge=self.request.challenge, slug=self.kwargs["slug"]
)

def get_form_kwargs(self):
Expand Down Expand Up @@ -868,8 +868,8 @@ def form_valid(self, form):

@cached_property
def phase(self):
return Phase.objects.get(
slug=self.kwargs["slug"], challenge=self.request.challenge
return get_object_or_404(
Phase, slug=self.kwargs["slug"], challenge=self.request.challenge
)

def get_success_url(self):
Expand Down

0 comments on commit 9ad7117

Please sign in to comment.