basic multiselect working

This commit is contained in:
vabene1111
2018-03-31 11:29:18 +02:00
parent 69e22c743a
commit eac41d6869
9 changed files with 44 additions and 9 deletions

View File

@@ -0,0 +1,2 @@
from cookbook.helper.dal import *
from cookbook.helper.dropbox import *

16
cookbook/helper/dal.py Normal file
View File

@@ -0,0 +1,16 @@
from dal import autocomplete
from cookbook.models import Keyword
class KeywordAutocomplete(autocomplete.Select2QuerySetView):
def get_queryset(self):
if not self.request.user.is_authenticated:
return Keyword.objects.none()
qs = Keyword.objects.all()
if self.q:
qs = qs.filter(name__istartswith=self.q)
return qs