Fix: student quiz perm and template tag mis configured

This commit is contained in:
Adil Mohak 2024-09-30 23:29:33 +03:00
parent 8cde63946f
commit ac7946092d
2 changed files with 6 additions and 5 deletions

View File

@ -246,14 +246,13 @@ class QuizTake(FormView):
self.quiz = get_object_or_404(Quiz, slug=self.kwargs["slug"])
self.course = get_object_or_404(Course, pk=self.kwargs["pk"])
quizQuestions = Question.objects.filter(quiz=self.quiz).count()
course = get_object_or_404(Course, pk=self.kwargs["pk"])
if quizQuestions <= 0:
messages.warning(request, f"Question set of the quiz is empty. try later!")
return redirect("quiz_index", self.course.slug)
if self.quiz.draft and not request.user.has_perm("quiz.change_quiz"):
raise PermissionDenied
# if self.quiz.draft and not request.user.has_perm("quiz.change_quiz"):
# raise PermissionDenied
self.sitting = Sitting.objects.user_sitting(
request.user, self.quiz, self.course

View File

@ -109,8 +109,10 @@
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body">
{% trans 'You can't go back to the previous question after you submit it,
so double check your answer before proceeding to the next one!' %}
{% blocktrans %}
You can't go back to the previous question after you submit it,
so double check your answer before proceeding to the next one!
{% endblocktrans %}
</div>
<div class="modal-footer">
<button type="button" class="btn btn-primary" data-bs-dismiss="modal">{% trans 'Understood' %}</button>