diff --git a/django/library/views.py b/django/library/views.py index bd314ae..e05de20 100644 --- a/django/library/views.py +++ b/django/library/views.py @@ -130,16 +130,17 @@ def delete_quiz(request, pk): def detail_quiz(request, pk): #quiz = get_object_or_404(QivipQuiz, pk=pk, user_id=request.user) quiz = get_object_or_404(QivipQuiz, pk=pk) + show_answers = request.GET.get('show_answers', 'false').lower() == 'true' questions = QivipQuestion.objects.filter(quiz_id=quiz) - # Parse JSON data for each question for question in questions: if question.data: question.data = json.loads(question.data) - + context = { 'quiz': quiz, - 'questions': questions + 'questions': questions, + 'detail':show_answers, } return render(request, 'library/detail_quiz.html', context) """ diff --git a/django/templates/library/detail_quiz.html b/django/templates/library/detail_quiz.html index 9fcd6ae..21a7e3d 100644 --- a/django/templates/library/detail_quiz.html +++ b/django/templates/library/detail_quiz.html @@ -2,7 +2,6 @@ {% block content %} -
{{ quiz.description }}
{% endif %} +- Richtige Antwort: - {{ option.value }} -
- {% endif %} - {% endfor %} ++ Richtige Antwort: + {{ option.value }} +
{% endif %} + {% endfor %} + + {% endif %} + + + {% endif %} +