mirror of
https://github.com/TandoorRecipes/recipes.git
synced 2026-01-09 16:18:00 -05:00
basic multiselect working
This commit is contained in:
16
cookbook/helper/dal.py
Normal file
16
cookbook/helper/dal.py
Normal 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
|
||||
Reference in New Issue
Block a user