How to show all fields of model in admin page?

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()]

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)