- [inlines.js] Fixed severe bug with number of TOTAL_FORMS when adding a new nested
- [tabular.html] Fixed look 'n feel of the nested table (dynamic colspan handling)
- [admin.py] Fixed exception using it with a no-deletable inline
- [project structure] Deleted inlines.min.js
- [admin.py] NestedModelAdmin was pointing to wrong js filename
- [admin.py] Fixed a bug that would be skip any custom validation in clean() method
Patches have been submitted, and repositories forked, but no one likes to use either one. Now, nested inlines are available in an easy-to-install package.
pip install -e git+git://github.com/silverfix/django-nested-inlines.git#egg=django-nested-inlines
nested_inlines.admin contains three
ModelAdmin subclasses to enable
nested inline support:
NestedTabularInline. To use them:
django.contrib.admin. This is because this app overrides certain admin templates and media.
NestedTabularInlinewherever you want to use nested inlines.
- On admin classes that will contain nested inlines, use
NestedModelAdminrather than the standard
- On inline classes, use
Nestedversions instead of the standard ones.
- Add an
inlines = [MyInline,]attribute to your inlines and watch the magic happen.
from django.contrib import admin from nested_inlines.admin import NestedModelAdmin, NestedStackedInline, NestedTabularInline from models import A, B, C class MyNestedInline(NestedTabularInline): model = C class MyInline(NestedStackedInline): model = B inlines = [MyNestedInline,] class MyAdmin(NestedModelAdmin): inlines = [MyInline,] admin.site.register(A, MyAdmin)
This package is mainly the work of other developers. I've only taken their patches and packaged them nicely for ease of use. Credit goes to:
- Gargamel for providing the base patch on the Django ticket.
- Stefan Klug for providing a fork with the patch applied, and for bugfixes.