开发者

Django - Single model inline without header

开发者 https://www.devze.com 2023-03-03 20:25 出处:网络
I have a generic inline which I am attaching to certain models. It works fine, but the admin interface looks kind of ugly:

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 Pa开发者_如何学PythongeMetaInline(generic.GenericStackedInline):
    model = PageMeta
    extra = 1
    max_num = 1

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


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消