4

When I create a TabularInline in my Django's admin panel, it displays a title per record. How can I change this title? How can I delete this title?

I include a screenshot below. The title I am referring to is here ExportLookupTableElement object. The lines without that title are the extra fields to add new ones. I want the entire table to look like this.

Screenshot

physicalattraction
  • 5,533
  • 9
  • 56
  • 112

1 Answers1

8

You can remove this title by overriding Django's admin css:

  1. Create css/custom_admin.css in your static directory with following code:
.inline-group .tabular tr.has_original td {
    padding-top: 8px;
}

.original {
    display: none;
}
  1. Edit your admin.py file to include this extra css for ModelAdmin that you want to remove title:
class TestDetailInline(admin.TabularInline):
    model = TestDetail

class TestAdmin(admin.ModelAdmin):
    class Media:
        css = {
            'all': ('css/custom_admin.css', )     # Include extra css
        }
    inlines = [TestDetailInline]

example django admin after override

Or you can override css for all admin pages by following this answer.

Community
  • 1
  • 1
nattster
  • 774
  • 2
  • 9
  • 17