This commit is contained in:
Ross
2021-05-03 22:05:46 +01:00
parent acb6c857bf
commit a17f63b510
2 changed files with 16 additions and 1 deletions
+1
View File
@@ -55,6 +55,7 @@ urlpatterns = [
path("exam/json/unbased", views.active_exams_unbased, name="active_exams_unbased"),
path("exam/submit", views.exam_submit, name="global_exam_answers_submit"),
#path('', include('generic.urls')),
path("feedback/<str:question_type>/<int:pk>", views.feedback_create, name="feedback_create"),
path('api/', include(router.urls)),
+15 -1
View File
@@ -6,6 +6,8 @@ from django import forms
from django.contrib.auth.decorators import login_required, user_passes_test
from django.contrib.auth.models import User
from django.contrib.contenttypes.models import ContentType
from django.contrib.auth.mixins import LoginRequiredMixin
from django.views.generic.edit import CreateView, UpdateView, DeleteView
@@ -26,9 +28,11 @@ from physics.models import Exam as PhysicsExam
from anatomy.models import CidUserAnswer as AnatomyCidUserAnswer
from anatomy.models import Exam as AnatomyExam
from anatomy.models import AnatomyQuestion
from rapids.models import CidUserAnswer as RapidsCidUserAnswer
from rapids.models import Exam as RapidsExam
from rapids.models import Rapid
from longs.models import CidUserAnswer as LongsCidUserAnswer
from longs.models import Exam as LongsExam
@@ -139,4 +143,14 @@ def exam_submit(request):
return JsonResponse({"success": False, "error": "Invalid exam type"})
# postExamAnswers
return JsonResponse({"success": False, "error": "Invalid data"})
return JsonResponse({"success": False, "error": "Invalid data"})
def feedback_create(request, question_type, pk):
if question_type == "anatomy":
content_type = ContentType.objects.get(model="AnatomyQuestion")
elif question_type == "rapid":
content_type = ContentType.objects.get(model="Rapid")
elif question_type == "long":
content_type = ContentType.objects.get(model="Long")
return JsonResponse({"success": False, "error": "Invalid exam type"})