You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
15 lines
366 B
Python
15 lines
366 B
Python
from dal import autocomplete
|
|
from wishlist.models import WishList
|
|
|
|
class WishListAutocomplete(autocomplete.Select2QuerySetView):
|
|
def get_queryset(self):
|
|
if not self.request.user.is_authenticated:
|
|
return WishList.objects.none()
|
|
qs = WishList.objects.all().filter(owner=self.request.user)
|
|
|
|
if self.q:
|
|
qs = qs.filter(name__startswith=self.q)
|
|
|
|
return qs
|
|
|