def init_hierarchy(cls, model_admin):
        """Initializes model admin with hierarchy data."""
        hierarchy = getattr(model_admin, 'hierarchy')

        if hierarchy:
            if not isinstance(hierarchy, Hierarchy):
                hierarchy = AdjacencyList()  # For `True` and etc. TODO heuristics maybe.

        else:
            hierarchy = NoHierarchy()

        model_admin.hierarchy = hierarchy
def init_hierarchy ( cls , model_admin ) : hierarchy = getattr ( model_admin , 'hierarchy' ) if hierarchy : if not isinstance ( hierarchy , Hierarchy ) : hierarchy = AdjacencyList ( ) else : hierarchy = NoHierarchy ( ) model_admin . hierarchy = hierarchy
Initializes model admin with hierarchy data.