Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Make sure we check which category property to

filter by. Surely, we need a proper Manager method
for this on products in the long while.
  • Loading branch information...
commit 06e249d88b4b749d3ff4b126d6bf4ca38fe04a96 1 parent b175ff7
@dokterbob dokterbob authored
Showing with 8 additions and 1 deletion.
  1. +8 −1 shopkit/category/basemodels.py
View
9 shopkit/category/basemodels.py
@@ -212,7 +212,14 @@ def get_products(self):
in_shop = product_class.in_shop
descendants = self.get_descendants(include_self=True)
- return in_shop.filter(categories__in=descendants).distinct()
+ # To do: Create in_category manager for products to circumvent
+ # this awkward lookup
+ if hasattr(product_class, 'categories'):
+ return in_shop.filter(categories__in=descendants).distinct()
+ else:
+ # Distinct not necessary - product can only be in one
+ # category. Haha.
+ return in_shop.filter(category__in=descendants)
def __unicode__(self):
""" The unicode representation of a nested category is that of
Please sign in to comment.
Something went wrong with that request. Please try again.