.
This commit is contained in:
@@ -40,6 +40,7 @@ from .forms import (
|
||||
from .models import (
|
||||
Case,
|
||||
Condition,
|
||||
Presentation,
|
||||
Series,
|
||||
Examination,
|
||||
Finding,
|
||||
@@ -740,6 +741,23 @@ class ConditionAutocomplete(autocomplete.Select2QuerySetView):
|
||||
|
||||
return qs
|
||||
|
||||
class PresentationAutocomplete(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 Presentation.objects.none()
|
||||
|
||||
qs = Presentation.objects.all()
|
||||
|
||||
if self.q:
|
||||
# This raises a fielderror which breaks creating a new item if not caught
|
||||
try:
|
||||
qs = qs.filter(name__icontains=self.q)
|
||||
except FieldError:
|
||||
return Presentation.objects.none()
|
||||
|
||||
return qs
|
||||
|
||||
|
||||
class FindingAutocomplete(autocomplete.Select2QuerySetView):
|
||||
def get_queryset(self):
|
||||
|
||||
Reference in New Issue
Block a user