.
This commit is contained in:
@@ -23,6 +23,7 @@ from django.views.generic import TemplateView
|
||||
from . import views
|
||||
|
||||
|
||||
|
||||
from rapids import views as rapid_views
|
||||
from anatomy import views as anatomy_views
|
||||
from longs import views as long_views
|
||||
@@ -58,6 +59,7 @@ urlpatterns = [
|
||||
path("feedback/<str:question_type>/<int:pk>", views.AddQuestionNote.as_view(), name="feedback_create"),
|
||||
#path("feedback/", views.AddQuestionNote.as_view(), name="feedback"),
|
||||
path("feedback/answer", views.answer_suggestion_submit, name="answer_suggestion_submit"),
|
||||
path("feedback/answer/confirm", views.answer_suggestion_confirm, name="answer_suggestion_confirm"),
|
||||
|
||||
|
||||
path('api/', include(router.urls)),
|
||||
|
||||
+22
-1
@@ -224,4 +224,25 @@ def answer_suggestion_submit(request):
|
||||
return JsonResponse({"success": True, "error": "Answer submited"})
|
||||
|
||||
# postExamAnswers
|
||||
return JsonResponse({"success": False, "error": "Invalid data"})
|
||||
return JsonResponse({"success": False, "error": "Invalid data"})
|
||||
|
||||
@login_required
|
||||
def answer_suggestion_confirm(request):
|
||||
if request.is_ajax and request.method == "POST":
|
||||
j = json.loads(request.body.decode())
|
||||
question_type = j["question_type"]
|
||||
aid = j["aid"]
|
||||
|
||||
if question_type == "anatomy":
|
||||
AnswerModel = AnatomyAnswer
|
||||
question = AnatomyQuestion
|
||||
elif question_type == "rapid":
|
||||
AnswerModel = RapidAnswer
|
||||
question = Rapid
|
||||
else:
|
||||
return JsonResponse({"success": False, "error": "Invalid question type"})
|
||||
|
||||
answer = get_object_or_404(AnswerModel, pk=qid)
|
||||
answer.proposed = False
|
||||
answer.save()
|
||||
return JsonResponse({"success": True, "error": "Answer changed"})
|
||||
|
||||
Reference in New Issue
Block a user