added custom autocomplete for category in product admin, still not working correctly
This commit is contained in:
@@ -223,12 +223,11 @@ class CategoryTagAutocomplete(autocomplete.Select2QuerySetView):
|
||||
Tag = Product.category.tag_model
|
||||
|
||||
# Return nothing if not auth
|
||||
if not self.request.is_authenticated():
|
||||
if self.request.user.is_anonymous:
|
||||
return Tag.objects.none()
|
||||
|
||||
qs = Tag.objects.all()
|
||||
|
||||
if self.q:
|
||||
qs = qs.filter(name__istartswith=self.q)
|
||||
qs = qs.filter(name__icontains=self.q)
|
||||
|
||||
return self.q
|
||||
return qs # [x.label for x in qs]
|
||||
|
||||
Reference in New Issue
Block a user