Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Django - Single model inline without header

I have a generic inline which I am attaching to certain models. It works fine, but the admin interface looks kind of ugly:

http://i.stack.imgur.com/dI3UH.png

As you can see, the same heading is repeated several times. In this instance I am only ever going to add one entry to the inline, which I have setup like so:

class PageMetaInline(generic.GenericStackedInline):
    model = PageMeta
    extra = 1
    max_num = 1

Is there any way to remove the unnecessary header "Page Meta: #1" ?

like image 771
Hanpan Avatar asked May 09 '11 20:05

Hanpan


1 Answers

You could override the admin template for stacked inlines for the PageMeta model.

Copy the original template (view current version in trunk on the Django site) to 'admin/yourapp/pagemeta/stacked.html', then customise by removing the html you do not wish to display.

like image 55
Alasdair Avatar answered Sep 25 '22 15:09

Alasdair