.
This commit is contained in:
+15
-2
@@ -1,5 +1,4 @@
|
|||||||
from rad.views import get_question_and_content_type
|
from django.shortcuts import render, get_object_or_404, redirect
|
||||||
from rad.views import get_question_and_c_object_or_404, redirect
|
|
||||||
|
|
||||||
from django.contrib.auth.decorators import login_required, user_passes_test
|
from django.contrib.auth.decorators import login_required, user_passes_test
|
||||||
from django.views.decorators.csrf import csrf_exempt
|
from django.views.decorators.csrf import csrf_exempt
|
||||||
@@ -42,6 +41,20 @@ import os
|
|||||||
|
|
||||||
#from rad.views import get_question_and_content_type
|
#from rad.views import get_question_and_content_type
|
||||||
|
|
||||||
|
def get_question_and_content_type(question_type):
|
||||||
|
if question_type == "rapid":
|
||||||
|
question = Rapid
|
||||||
|
content_type = ContentType.objects.get(model="rapid")
|
||||||
|
elif question_type == "anatomy":
|
||||||
|
question = AnatomyQuestion
|
||||||
|
content_type = ContentType.objects.get(model="anatomyquestion")
|
||||||
|
elif question_type == "long":
|
||||||
|
question = Long
|
||||||
|
content_type = ContentType.objects.get(model="long")
|
||||||
|
else:
|
||||||
|
raise PermissionError()
|
||||||
|
|
||||||
|
return question, content_type
|
||||||
|
|
||||||
# Create your views here.
|
# Create your views here.
|
||||||
@login_required
|
@login_required
|
||||||
|
|||||||
+1
-14
@@ -1,3 +1,4 @@
|
|||||||
|
from generic.views import get_question_and_content_type
|
||||||
from django.core.exceptions import PermissionDenied
|
from django.core.exceptions import PermissionDenied
|
||||||
from django.shortcuts import render, get_object_or_404, redirect
|
from django.shortcuts import render, get_object_or_404, redirect
|
||||||
from django.views.decorators.csrf import csrf_exempt
|
from django.views.decorators.csrf import csrf_exempt
|
||||||
@@ -185,20 +186,6 @@ def feedback_create(request, question_type, pk):
|
|||||||
|
|
||||||
return JsonResponse({"success": False, "error": "Invalid exam type"})
|
return JsonResponse({"success": False, "error": "Invalid exam type"})
|
||||||
|
|
||||||
def get_question_and_content_type(question_type):
|
|
||||||
if question_type == "rapid":
|
|
||||||
question = Rapid
|
|
||||||
content_type = ContentType.objects.get(model="rapid")
|
|
||||||
elif question_type == "anatomy":
|
|
||||||
question = AnatomyQuestion
|
|
||||||
content_type = ContentType.objects.get(model="anatomyquestion")
|
|
||||||
elif question_type == "long":
|
|
||||||
question = Long
|
|
||||||
content_type = ContentType.objects.get(model="long")
|
|
||||||
else:
|
|
||||||
raise PermissionError()
|
|
||||||
|
|
||||||
return question, content_type
|
|
||||||
|
|
||||||
|
|
||||||
class AddQuestionNote(CreateView):
|
class AddQuestionNote(CreateView):
|
||||||
|
|||||||
Reference in New Issue
Block a user