There has been some movement in https://code.djangoproject.com/ticket/9025 recently, but I wouldn’t hold my breath.
One common way around this is to link to an admin between first and second (or second and third) level by having both a ModelAdmin
and an Inline for the same model:
Give Certificate
a ModelAdmin
with TrainingDate
as an inline. Set show_change_link = True
for CertificateInline
so you can click on an inline to go to its ModelAdmin
change form.
admin.py:
# Certificate change form has training dates as inline
class TrainingDateInline(admin.StackedInline):
model = TrainingDate
class CertificateAdmin(admin.ModelAdmin):
inlines = [TrainingDateInline,]
admin.site.register(Certificate ,CertificateAdmin)
# Person has Certificates inline but rather
# than nesting inlines (not possible), shows a link to
# its own ModelAdmin's change form, for accessing TrainingDates:
class CertificateLinkInline(admin.TabularInline):
model = Certificate
# Whichever fields you want: (I usually use only a couple
# needed to identify the entry)
fields = ('cerfificate_no', 'certificate_date')
# Django 1.8 introduced this, no need to make your own link
show_change_link = True
class PersonAdmin(admin.ModelAdmin):
inlines = [CertificateLinkInline,]
admin.site.register(Person, PersonAdmin)