Fix: student quiz perm and template tag mis configured
This commit is contained in:
parent
8cde63946f
commit
ac7946092d
@ -246,14 +246,13 @@ class QuizTake(FormView):
|
|||||||
self.quiz = get_object_or_404(Quiz, slug=self.kwargs["slug"])
|
self.quiz = get_object_or_404(Quiz, slug=self.kwargs["slug"])
|
||||||
self.course = get_object_or_404(Course, pk=self.kwargs["pk"])
|
self.course = get_object_or_404(Course, pk=self.kwargs["pk"])
|
||||||
quizQuestions = Question.objects.filter(quiz=self.quiz).count()
|
quizQuestions = Question.objects.filter(quiz=self.quiz).count()
|
||||||
course = get_object_or_404(Course, pk=self.kwargs["pk"])
|
|
||||||
|
|
||||||
if quizQuestions <= 0:
|
if quizQuestions <= 0:
|
||||||
messages.warning(request, f"Question set of the quiz is empty. try later!")
|
messages.warning(request, f"Question set of the quiz is empty. try later!")
|
||||||
return redirect("quiz_index", self.course.slug)
|
return redirect("quiz_index", self.course.slug)
|
||||||
|
|
||||||
if self.quiz.draft and not request.user.has_perm("quiz.change_quiz"):
|
# if self.quiz.draft and not request.user.has_perm("quiz.change_quiz"):
|
||||||
raise PermissionDenied
|
# raise PermissionDenied
|
||||||
|
|
||||||
self.sitting = Sitting.objects.user_sitting(
|
self.sitting = Sitting.objects.user_sitting(
|
||||||
request.user, self.quiz, self.course
|
request.user, self.quiz, self.course
|
||||||
|
|||||||
@ -109,8 +109,10 @@
|
|||||||
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
|
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
|
||||||
</div>
|
</div>
|
||||||
<div class="modal-body">
|
<div class="modal-body">
|
||||||
{% trans 'You can't go back to the previous question after you submit it,
|
{% blocktrans %}
|
||||||
so double check your answer before proceeding to the next one!' %}
|
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>
|
||||||
<div class="modal-footer">
|
<div class="modal-footer">
|
||||||
<button type="button" class="btn btn-primary" data-bs-dismiss="modal">{% trans 'Understood' %}</button>
|
<button type="button" class="btn btn-primary" data-bs-dismiss="modal">{% trans 'Understood' %}</button>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user