Django Hierarchical Models
A Django app that provides a hierarchical configuration pattern with automatic inheritance between related models at any number of levels deep.
Documentation
- Getting Started
- Core Concepts
- Basic Usage
- Forms Integration
- Admin Integration
- ManyToMany Fields
- ManyToMany Through Relations
- API Reference
- Troubleshooting
Use Cases
- Feature Flags
- Multi-tenant Configuration
- Hierarchical Permissions
- Organization Settings
- Simple Configuration
Features
- 🔄 Automatic inheritance of values from parent models through unlimited hierarchy levels
- 🛠️ Simple API using standard Django model field access
- 🎯 Override values at any level in the hierarchy
- 📋 Shadow fields with underscore prefix for storing overrides
- ✅ Works with any Django model field type, including ManyToMany relationships
- 📊 Visual indicators of inheritance in admin interface
- 🔄 Unlimited depth of inheritance (not limited to just parent-child relationships)
- 🧩 Easy integration with Django forms using shadow fields
- ⚙️ Configurable via Django settings
Installation
pip install djhierarchical
Add hierarchical to your INSTALLED_APPS setting:
INSTALLED_APPS = [
# ...
'hierarchical',
# ...
]
Note: The package name on PyPI is djhierarchical, but the Django app name to use in INSTALLED_APPS is hierarchical.
Links
License
This project is licensed under the MIT License - see the LICENSE file for details.