flask_taxonomies/api.py
def list_taxonomies(self, session=None, return_descendants_count=False,
                        return_descendants_busy_count=False):
        """Return a list of all available taxonomies."""
        session = session or self.session

        query_parts = [Taxonomy]
        if return_descendants_count:
            aliased_descendant = aliased(TaxonomyTerm, name='aliased_descendant')
            stmt = session.query(func.count(aliased_descendant.id))
            stmt = stmt.filter(aliased_descendant.taxonomy_id == Taxonomy.id)
            stmt = stmt.label('descendants_count')
            query_parts.append(stmt)

        if return_descendants_busy_count:
            aliased_descendant = aliased(TaxonomyTerm, name='aliased_abc_descendant')
            stmt = session.query(func.count(aliased_descendant.id))
            stmt = stmt.filter(aliased_descendant.taxonomy_id == Taxonomy.id)
            stmt = stmt.filter(aliased_descendant.busy_count > 0)
            stmt = stmt.label('descendants_busy_count')
            query_parts.append(stmt)

        ret = session.query(*query_parts)

        return ret
Return a list of all available taxonomies.
Return a list of all available taxonomies.
Return a list of all available taxonomies .
def list_taxonomies(self, session=None, return_descendants_count=False,
                        return_descendants_busy_count=False):
        session = session or self.session
        query_parts = [Taxonomy]
        if return_descendants_count:
            aliased_descendant = aliased(TaxonomyTerm, name='aliased_descendant')
            stmt = session.query(func.count(aliased_descendant.id))
            stmt = stmt.filter(aliased_descendant.taxonomy_id == Taxonomy.id)
            stmt = stmt.label('descendants_count')
            query_parts.append(stmt)
        if return_descendants_busy_count:
            aliased_descendant = aliased(TaxonomyTerm, name='aliased_abc_descendant')
            stmt = session.query(func.count(aliased_descendant.id))
            stmt = stmt.filter(aliased_descendant.taxonomy_id == Taxonomy.id)
            stmt = stmt.filter(aliased_descendant.busy_count > 0)
            stmt = stmt.label('descendants_busy_count')
            query_parts.append(stmt)
        ret = session.query(*query_parts)
        return ret
def list_taxonomies ( self , session = None , return_descendants_count = False , return_descendants_busy_count = False ) : session = session or self . session query_parts = [ Taxonomy ] if return_descendants_count : aliased_descendant = aliased ( TaxonomyTerm , name = 'aliased_descendant' ) stmt = session . query ( func . count ( aliased_descendant . id ) ) stmt = stmt . filter ( aliased_descendant . taxonomy_id == Taxonomy . id ) stmt = stmt . label ( 'descendants_count' ) query_parts . append ( stmt ) if return_descendants_busy_count : aliased_descendant = aliased ( TaxonomyTerm , name = 'aliased_abc_descendant' ) stmt = session . query ( func . count ( aliased_descendant . id ) ) stmt = stmt . filter ( aliased_descendant . taxonomy_id == Taxonomy . id ) stmt = stmt . filter ( aliased_descendant . busy_count > 0 ) stmt = stmt . label ( 'descendants_busy_count' ) query_parts . append ( stmt ) ret = session . query ( * query_parts ) return ret
Return a list of all available taxonomies.
Return a list of all available taxonomies .
"""Return a list of all available taxonomies."""
self
session
return_descendants_count
return_descendants_busy_count