Displaying table header even when there is no content? (django admin page)

230 Views Asked by At

I want the table to appear with all headings even when there is no content. Now, only 'Add' button appears when there isn't anything in the database. How do I do this? Please help

It looks like this with no content:

enter image description here

It looks like this with content:

enter image description here

So with no content, it should still show the table headings. Suggest any way?

1

There are 1 best solutions below

0
On BEST ANSWER

Copy the template at django/contrib/admin/templates/admin/change_list_results.html to your admin template folder.

Keep that structure:

project -app -templates -admin -change_list_results.html -manage.py

Than, remove the {% if results %} - {% endif %} tags from the new template file and it should work.