Skip to content

Commit

Permalink
raise a 404 if the marking session name is bad
Browse files Browse the repository at this point in the history
  • Loading branch information
struan committed Dec 19, 2024
1 parent 863ecd3 commit d19b35e
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions crowdsourcer/middleware.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from django.conf import settings
from django.http import Http404

from crowdsourcer.models import MarkingSession, ResponseType

Expand All @@ -21,6 +22,8 @@ def process_view(self, request, view_func, view_args, view_kwargs):
current_session = MarkingSession.objects.filter(
label=session_name, active=True
).first()
if current_session is None:
raise Http404
else:
current_session = (
MarkingSession.objects.filter(active=True).order_by("-default").first()
Expand Down

0 comments on commit d19b35e

Please sign in to comment.