django-nested-admin provides Django admin classes that allow for deeply nested inlines within the Django administration interface. It extends Django's native `InlineModelAdmin` functionality to support multiple levels of related objects. The current version is 4.1.6, and it typically releases new versions to maintain compatibility with new Django releases.
pip install django-nested-adminVerified import paths — ran on the pinned version, not inferred.
To use `django-nested-admin`, define your models, then create `NestedTabularInline` or `NestedStackedInline` classes for your child models, nesting them as needed. Finally, register your top-level model with `NestedModelAdmin` in your `admin.py` file. This example demonstrates a three-level nesting: Grandparent -> Parent -> Child.
Upgrade your Django project to Django 3.2+ and Python 3.6+ before upgrading to django-nested-admin v4.0.0 or later.
Review custom `admin.py` files for any overrides of `formfield_for_dbfield` and update their signatures to match the latest Django/nested-admin expectations. Check `ModelAdmin` and `InlineModelAdmin` documentation for current method signatures.
Always check the `django-nested-admin` release notes and `requirements.txt` for your target version of Django before upgrading. Pin `django-nested-admin` to a compatible version in your project's dependencies.
Ensure `django-nested-admin` and `django-grappelli` versions are known to be compatible. If issues arise, test with a simpler admin setup to isolate the problem, and consult the `django-nested-admin` GitHub issues for Grappelli-related discussions.
If custom JavaScript is failing to initialize or re-initialize on dynamically added nested inlines, ensure it's listening for the appropriate `CustomEvent` events dispatched by `django-nested-admin` on the document or relevant formset elements.