Skip to the content.

API Reference for Django Hierarchical Models

This document provides a detailed reference of all classes, methods, and attributes in the Django Hierarchical Models package.

Models

HierarchicalModelMixin

The core mixin that provides hierarchical inheritance capabilities to Django models.

Attributes

Methods

HierarchicalManagerMixin

A mixin for model managers that adds support for hierarchical property fields.

Methods

HierarchicalManager

A ready-to-use manager for hierarchical models that extends HierarchicalManagerMixin and Django’s default models.Manager.

Forms

The forms module has been simplified. Standard Django forms should be used with hierarchical models by directly handling the shadow fields (prefixed with underscore).

See the Forms Integration document for examples and best practices.

Admin

HierarchicalModelAdmin

A custom ModelAdmin for Django admin integration.

Methods

Utility Functions

has_hierarchical_field(model_class, field_name)

Checks if a model class has a hierarchical field with the given name.

Parameters

Returns

get_hierarchical_setting(key, default=None)

Gets a setting from the HIERARCHICAL_MODELS settings dictionary.

Parameters

Returns