mirror of
https://github.com/TandoorRecipes/recipes.git
synced 2025-12-31 20:00:38 -05:00
basic multiselect working
This commit is contained in:
@@ -0,0 +1,2 @@
|
||||
from cookbook.helper.dal import *
|
||||
from cookbook.helper.dropbox import *
|
||||
|
||||
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