return only wine-color tags
This commit is contained in:
parent
b6b1d8ab2a
commit
ca7d7f0fa8
|
|
@ -43,8 +43,8 @@ class TagCategoryFilterSet(TagsBaseFilterSet):
|
|||
'product_type', )
|
||||
|
||||
def by_product_type(self, queryset, name, value):
|
||||
# if value == product_models.ProductType.WINE:
|
||||
# queryset = queryset.filter(index_name='wine-color').filter(tags__products__isnull=False)
|
||||
if value == product_models.ProductType.WINE:
|
||||
return queryset.wine_tags_category().filter(tags__products__isnull=False)
|
||||
queryset = queryset.by_product_type(value)
|
||||
return queryset
|
||||
|
||||
|
|
|
|||
|
|
@ -111,6 +111,9 @@ class TagCategoryQuerySet(models.QuerySet):
|
|||
"""Filter by product type index name."""
|
||||
return self.filter(tags__products__product_type__index_name=index_name)
|
||||
|
||||
def wine_tags_category(self):
|
||||
return self.filter(index_name='wine-color')
|
||||
|
||||
def with_tags(self, switcher=True):
|
||||
"""Filter by existing tags."""
|
||||
return self.exclude(tags__isnull=switcher)
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user