django admin interface - how do I collapse/expand object details in the change list view?
I would like to be able to collapse and ex开发者_如何学JAVApand object details when showing objects in the django admin change list view. For example, for an order, I would like the order list to first appear as:
+ id: 1, name: John Smith + id: 2, name: Jane DoeAnd then when the user expands one order:
- id: 1, name: John Smith address: 321 Oaktree Drive, LA, CA + id: 2, name: Jane Doeinline objects won't work, because the order does not have a foreign key to itself. If anyone could point me in the right direction, it would be greatly appreciated.
You can override/extend both the template (ModelAdmin.change_list_template
) and the view (ModelAdmin.changelist_view
). The original view accepts extra_context
, so you can easily add whatever you need. See contrib.admin documentation for more details.
精彩评论