Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to override django edit_inline/tabular.html for only 1 app?

I can override edit_inline/tabular.html if I save it in my overall template directory (for example mysite/templates/admin/edit_inline/tabular.html), but when I try to save it with other admin template, like change_form.html (in mysite/myapp/templates/admin/myapp/mymodel/change_form.html, it doesn't works.

like image 837
Kepioo Avatar asked Feb 15 '10 02:02

Kepioo


1 Answers

I come across this thread which is a bit old, in fact for the inline model you need to explicitly set your new template in your admin.py like below :

class ModelInlineAdmin(admin.StackedInline):
    model = Product
    template = "admin/products/product/edit_inline/stacked.html"

check this http://blog.ruedaminute.com/2011/05/django-journal-override-a-django-admin-template-inline-or-otherwise/

like image 51
elsadek Avatar answered Jan 03 '23 14:01

elsadek