开发者

Django Display more fields in manytomany relationship on admin page

开发者 https://www.devze.com 2023-02-14 18:29 出处:网络
I have a page build model that has 开发者_开发知识库a manytomanyfield All i want is to display the other columns of the manytomany field model

I have a page build model that has 开发者_开发知识库a manytomanyfield All i want is to display the other columns of the manytomany field model

I have an image model with name and category fields and I want both to display on the admin page in an inline table with a filter instead of a many to many field.


Use the inlines property of the ModelAdmin class.

First, define an InlineModelAdmin (the Django documentation covers it here). Then, set the inlines property of your page build model to a list or tuple with the class you created. You'll get exactly the behavior you want.

0

精彩评论

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