开发者

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 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 accepts extra_context, so you can easily add whatever you need. See contrib.admin documentation for more details.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜