I would like to be able to collapse and expand 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 Doe
And then when the user expands one order:
– id: 1, name: John Smith
address: 321 Oaktree Drive, LA, CA
+ id: 2, name: Jane Doe
inline 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 acceptsextra_context, so you can easily add whatever you need. See contrib.admin documentation for more details.