From 7b5458202a2e30aaec9cc617a96d0babc677b2f3 Mon Sep 17 00:00:00 2001 From: Ross Date: Mon, 16 Aug 2021 14:26:34 +0000 Subject: [PATCH] . --- rapids/templates/rapids/question_detail.html | 1 + rapids/templates/rapids/question_user_answers.html | 10 ++++++++++ rapids/urls.py | 1 + rapids/views.py | 12 ++++++++++++ 4 files changed, 24 insertions(+) create mode 100644 rapids/templates/rapids/question_user_answers.html diff --git a/rapids/templates/rapids/question_detail.html b/rapids/templates/rapids/question_detail.html index 6a5d3e4e..dfc0b14a 100755 --- a/rapids/templates/rapids/question_detail.html +++ b/rapids/templates/rapids/question_detail.html @@ -22,6 +22,7 @@ Add Note {% if request.user.is_superuser %} Admin Edit +Admin Edit {% endif %} {% include 'rapids/question_display_block.html' %} {% endblock %} \ No newline at end of file diff --git a/rapids/templates/rapids/question_user_answers.html b/rapids/templates/rapids/question_user_answers.html new file mode 100644 index 00000000..92a88089 --- /dev/null +++ b/rapids/templates/rapids/question_user_answers.html @@ -0,0 +1,10 @@ +{% extends 'rapids/base.html' %} + +{% block content %} + + +{% endblock %} \ No newline at end of file diff --git a/rapids/urls.py b/rapids/urls.py index c6602415..d2d69ed4 100755 --- a/rapids/urls.py +++ b/rapids/urls.py @@ -18,6 +18,7 @@ urlpatterns = [ #path("all_questions/", views.all_questions, name="all_questions"), path("question//scrap", views.rapid_scrap, name="rapid_scrap"), path("question//delete", views.QuestionDelete.as_view(), name="question_delete"), + path("question//user_answers", views.question_user_answers, name="question_user_answers"), path("exam///mark", views.mark, name="mark"), path("exam//mark", views.RapidExamViews.mark_overview, name="mark_overview"), # path("exam///", views.exam_take, name="exam_take"), diff --git a/rapids/views.py b/rapids/views.py index 9655c837..bc39b0e6 100755 --- a/rapids/views.py +++ b/rapids/views.py @@ -126,6 +126,18 @@ def question_detail(request, pk): ) +@login_required +def question_user_answers(request, pk): + rapid = get_object_or_404(Rapid, pk=pk) + + answers = CidUserAnswer.objects.filter(question__id=rapid.pk) + + return render( + request, + "rapids/question_user_answers.html", + {"question": rapid, "answers": answers}, + ) + @login_required def rapid_split(request, pk): rapid = get_object_or_404(Rapid, pk=pk)