.
This commit is contained in:
+17
-5
@@ -27,7 +27,16 @@ from .forms import (
|
|||||||
AnswerFormSet,
|
AnswerFormSet,
|
||||||
AnswerUpdateFormSet,
|
AnswerUpdateFormSet,
|
||||||
)
|
)
|
||||||
from .models import Rapid, Note, Abnormality, Region, Examination
|
from .models import (
|
||||||
|
Rapid,
|
||||||
|
Note,
|
||||||
|
Abnormality,
|
||||||
|
Region,
|
||||||
|
Examination,
|
||||||
|
Exam,
|
||||||
|
Answer,
|
||||||
|
CidUserAnswer,
|
||||||
|
)
|
||||||
from .tables import RapidTable
|
from .tables import RapidTable
|
||||||
from .filters import RapidFilter
|
from .filters import RapidFilter
|
||||||
|
|
||||||
@@ -61,6 +70,8 @@ class AuthorOrCheckerRequiredMixin(object):
|
|||||||
def index(request):
|
def index(request):
|
||||||
exams = Exam.objects.all()
|
exams = Exam.objects.all()
|
||||||
return render(request, "rapids/index.html", {"exams": exams})
|
return render(request, "rapids/index.html", {"exams": exams})
|
||||||
|
|
||||||
|
|
||||||
# def index(request):
|
# def index(request):
|
||||||
# other_rapids = Rapid.objects.exclude(author=request.user.pk)
|
# other_rapids = Rapid.objects.exclude(author=request.user.pk)
|
||||||
# user_rapids = Rapid.objects.filter(author=request.user.pk)
|
# user_rapids = Rapid.objects.filter(author=request.user.pk)
|
||||||
@@ -255,9 +266,7 @@ class RapidCreateBase(LoginRequiredMixin, CreateView):
|
|||||||
self.request.POST, self.request.FILES
|
self.request.POST, self.request.FILES
|
||||||
)
|
)
|
||||||
context["image_formset"].full_clean()
|
context["image_formset"].full_clean()
|
||||||
context["answer_formset"] = AnswerFormSet(
|
context["answer_formset"] = AnswerFormSet(self.request.POST)
|
||||||
self.request.POST
|
|
||||||
)
|
|
||||||
context["answer_formset"].full_clean()
|
context["answer_formset"].full_clean()
|
||||||
else:
|
else:
|
||||||
context["image_formset"] = ImageFormSet()
|
context["image_formset"] = ImageFormSet()
|
||||||
@@ -492,7 +501,9 @@ def loadJsonAnswer(answer):
|
|||||||
if (not isinstance(answer["cid"], int)) or (
|
if (not isinstance(answer["cid"], int)) or (
|
||||||
not isinstance(answer["eid"], int) or (not isinstance(answer["ans"], str))
|
not isinstance(answer["eid"], int) or (not isinstance(answer["ans"], str))
|
||||||
):
|
):
|
||||||
return JsonResponse({"success": False, "error": "cid or eid or answers not defined"})
|
return JsonResponse(
|
||||||
|
{"success": False, "error": "cid or eid or answers not defined"}
|
||||||
|
)
|
||||||
|
|
||||||
# The model should catch invalid data but this should be less intensive
|
# The model should catch invalid data but this should be less intensive
|
||||||
max_int = 999999999999999999999
|
max_int = 999999999999999999999
|
||||||
@@ -1038,6 +1049,7 @@ def exam_question_detail(request, pk, sk):
|
|||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@login_required
|
@login_required
|
||||||
def exam_list(request):
|
def exam_list(request):
|
||||||
exams = Exam.objects.all()
|
exams = Exam.objects.all()
|
||||||
|
|||||||
Reference in New Issue
Block a user