def get_absolute_url(self): categories = get_categories() try: category = filter(lambda x: x.pk == self.category_id, categories)[0] category_path = category.get_path() except IndexError: category_path = "-" return ('plugshop-product', None, { 'category_path': category_path, 'slug': self.slug, })
def get_ancestor_list(self): categories = get_categories() return [n for n in categories if n.lft <= self.lft and n.rght >= self.rght and n.tree_id == self.tree_id]