move anatomy structure to atlas
This commit is contained in:
@@ -35,7 +35,6 @@ from .forms import (
|
||||
ExaminationForm,
|
||||
MarkAnatomyQuestionForm,
|
||||
AnatomyQuestionForm,
|
||||
StructureForm,
|
||||
ExamForm,
|
||||
)
|
||||
from .models import (
|
||||
@@ -674,18 +673,6 @@ def get_examination_id(request):
|
||||
return HttpResponse("/")
|
||||
|
||||
|
||||
@login_required
|
||||
def create_structure(request):
|
||||
form = StructureForm(request.POST or None)
|
||||
if form.is_valid():
|
||||
instance = form.save()
|
||||
return HttpResponse(
|
||||
'<script>opener.closePopup(window, "%s", "%s", "#id_structure");</script>'
|
||||
% (instance.pk, instance)
|
||||
)
|
||||
return render(
|
||||
request, "anatomy/create_simple.html", {"form": form, "name": "Structure"}
|
||||
)
|
||||
|
||||
|
||||
@csrf_exempt
|
||||
@@ -807,20 +794,3 @@ GenericViews = GenericViewBase("anatomy", AnatomyQuestion, UserAnswer, Exam)
|
||||
class ExamClone(ExamCloneMixin, ExamCreate):
|
||||
"""Clone exam view"""
|
||||
|
||||
|
||||
class StructureAutocomplete(autocomplete.Select2QuerySetView):
|
||||
def get_queryset(self):
|
||||
# Don't forget to filter out results depending on the visitor !
|
||||
if not self.request.user.is_authenticated:
|
||||
return Structure.objects.none()
|
||||
|
||||
qs = Structure.objects.all()
|
||||
|
||||
if self.q:
|
||||
# This raises a fielderror which breaks creating a new item if not caught
|
||||
try:
|
||||
qs = qs.filter(structure__icontains=self.q)
|
||||
except FieldError:
|
||||
return Structure.objects.none()
|
||||
|
||||
return qs
|
||||
|
||||
Reference in New Issue
Block a user