(self)
return categorys
获得当前分类目录所有子集
        :return:
获得当前分类目录所有子集
        :return:
获得当前分类目录所有子集 : return :
def get_sub_categorys(self):
        """
        获得当前分类目录所有子集
        :return:
        """
        categorys = []
        all_categorys = Category.objects.all()

        def parse(category):
            if category not in categorys:
                categorys.append(category)
            childs = all_categorys.filter(parent_category=category)
            for child in childs:
                if category not in categorys:
                    categorys.append(child)
                parse(child)

        parse(self)
        return categorys
def get_sub_categorys ( self ) : categorys = [ ] all_categorys = Category . objects . all ( ) def parse ( category ) : if category not in categorys : categorys . append ( category ) childs = all_categorys . filter ( parent_category = category ) for child in childs : if category not in categorys : categorys . append ( child ) parse ( child ) parse ( self ) return categorys