here is the models page
In this picture, only the title shows up on here, I used:
def __unicode__(self): return self.title;
here is the each individual objects
How do I show all these fields?
How do I show all the fields in each Model page?
You can check the admin.py file in your project app directory. If it is not there, just create one. Edit admin.py and add below lines of code to register model for admin dashboard. Here, we are showing all the model fields in the admin site.
If you want to include all fields without typing all fieldnames, you can use
list_display = BookAdmin._meta.get_all_field_names()
The drawback is, the fields are in sorted order.
Edit:
This method has been deprecated in Django 1.10 See Migrating from old API for reference. Following should work instead for Django >= 1.9
for most cases -
list_display = [field.name for field in Book._meta.get_fields()]
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With