.
This commit is contained in:
@@ -24,6 +24,8 @@ from django.http import Http404, JsonResponse
|
||||
|
||||
from django.http import HttpResponseRedirect, HttpResponse
|
||||
|
||||
from dal import autocomplete
|
||||
|
||||
from .forms import (
|
||||
AnatomyAnswerForm,
|
||||
AnswerFormSet,
|
||||
@@ -998,3 +1000,16 @@ GenericViews = GenericViewBase("anatomy", AnatomyQuestion, CidUserAnswer, 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:
|
||||
qs = qs.filter(name__istartswith=self.q)
|
||||
|
||||
return qs
|
||||
Reference in New Issue
Block a user