How to show all fields of model in admin page?

后端 未结 11 630
無奈伤痛
無奈伤痛 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 16:42

    Every solution found here raises an error like this

    The value of 'list_display[n]' must not be a ManyToManyField.

    If the model contains a Many to Many field.

    A possible solution that worked for me is:

    list_display = [field.name for field in MyModel._meta.get_fields() if not x.many_to_many]

提交回复
热议问题