.
This commit is contained in:
+17
-5
@@ -27,7 +27,16 @@ from .forms import (
|
||||
AnswerFormSet,
|
||||
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 .filters import RapidFilter
|
||||
|
||||
@@ -61,6 +70,8 @@ class AuthorOrCheckerRequiredMixin(object):
|
||||
def index(request):
|
||||
exams = Exam.objects.all()
|
||||
return render(request, "rapids/index.html", {"exams": exams})
|
||||
|
||||
|
||||
# def index(request):
|
||||
# other_rapids = Rapid.objects.exclude(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
|
||||
)
|
||||
context["image_formset"].full_clean()
|
||||
context["answer_formset"] = AnswerFormSet(
|
||||
self.request.POST
|
||||
)
|
||||
context["answer_formset"] = AnswerFormSet(self.request.POST)
|
||||
context["answer_formset"].full_clean()
|
||||
else:
|
||||
context["image_formset"] = ImageFormSet()
|
||||
@@ -492,7 +501,9 @@ def loadJsonAnswer(answer):
|
||||
if (not isinstance(answer["cid"], int)) or (
|
||||
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
|
||||
max_int = 999999999999999999999
|
||||
@@ -1038,6 +1049,7 @@ def exam_question_detail(request, pk, sk):
|
||||
},
|
||||
)
|
||||
|
||||
|
||||
@login_required
|
||||
def exam_list(request):
|
||||
exams = Exam.objects.all()
|
||||
|
||||
Reference in New Issue
Block a user