Improve error messages for exam availability in Http404 responses
This commit is contained in:
+4
-2
@@ -783,10 +783,12 @@ class ExamOrCollectionGenericBase(models.Model, AuthorMixin):
|
||||
if self.start_date >= timezone.now() or (
|
||||
self.end_date is not None and self.end_date <= timezone.now()
|
||||
):
|
||||
raise Http404("Exam not found")
|
||||
# Raise with an explanatory message so the frontend can
|
||||
# surface the reason to the end user.
|
||||
raise Http404("Exam not currently available (outside allowed dates)")
|
||||
# If it is not active no one can take
|
||||
elif active_only and not self.active:
|
||||
raise Http404("Exam not found")
|
||||
raise Http404("Exam currently inactive")
|
||||
|
||||
# If candidates only check they have access
|
||||
if self.candidates_only:
|
||||
|
||||
Reference in New Issue
Block a user