How to show all fields of model in admin page?

后端 未结 11 629
無奈伤痛
無奈伤痛 2021-01-30 16:25

here is the models page

In this picture, only the title shows up on here, I used:

 def __unicode__(self):
        return self.title;  

11条回答
  •  谎友^
    谎友^ (楼主)
    2021-01-30 17:07

    I found OBu's answer here to be very useful for me. He mentions:

    The drawback is, the fields are in sorted order.

    A small adjustment to his method solves this problem as well:

    list_display  = [f.name for f in Book._meta.fields]
    

    Worked for me.

提交回复
热议问题