#9025: Nested Inline Support in Admin
-------------------------------+------------------------------------
Reporter: pixelcort | Owner: Gargamel
Type: New feature | Status: assigned
Component: contrib.admin | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 1 | Patch needs improvement: 1
Easy pickings: 0 | UI/UX: 1
-------------------------------+------------------------------------
Comment (by RichardOfWard):
Tested also, works like a charm, nice work Gargamel, given the '+1'
comments here I suspect you'll have made a bunch of people happy.
{{{#!python
from django.contrib import admin
from .models import Band, Venue, Event, EventInstance, Booking
class BookingAdminInline(admin.TabularInline):
model = Booking
class EventInstanceAdminInline(admin.TabularInline):
model = EventInstance
inlines = (BookingAdminInline,)
class EventAdmin(admin.ModelAdmin):
inlines = (EventInstanceAdminInline,)
admin.site.register(Band, admin.ModelAdmin)
admin.site.register(Venue, admin.ModelAdmin)
admin.site.register(Event, EventAdmin)
}}}
One slight issue is that it becomes a bit difficult to tell what field you
are looking at when using a TabularInline - see the red arrows here:
http://oi48.tinypic.com/4gm5w2.jpg. The stacked version looks fine and the
fields are clearly labelled: http://i48.tinypic.com/rwnejt.png. Not sure
what the fix would be (other than simply not using TabularInline for
anything other than the innermost model), or even if it needs fixing.
Perhaps an extra header row after each nested model? Maybe only bother to
support StackedInline nesting? Probably a different bug for a different
day.
Otherwise, great stuff, intuitive to use - like pztrick I previously tried
adding an 'inlines' definition expecting it to work.
PS, I couldn't apply your patch (tried 'git am nested_inlines_2.diff',
'patch -p1 < nested_inlines_2.diff') without first poking it with a big
regex. What was I doing wrong?
--
Ticket URL: <https://code.djangoproject.com/ticket/9025#comment:113>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit https://groups.google.com/groups/opt_out.