Separate the autocompletion logic form the views

This commit is contained in:
Martin Pépin 2020-07-04 13:50:19 +02:00
parent fbbc9937f6
commit 9a90f19502
No known key found for this signature in database
GPG key ID: E7520278B1774448
12 changed files with 78 additions and 82 deletions

11
shared/views.py Normal file
View file

@ -0,0 +1,11 @@
from dal import autocomplete
from shared.autocomplete import ModelSearch
class Select2QuerySetView(ModelSearch, autocomplete.Select2QuerySetView):
"""Compatibility layer between ModelSearch and Select2QuerySetView."""
def get_queryset(self):
keywords = self.q.split()
return super().search(keywords)