Overriding change_list.html for custom app

1,228 views
Skip to first unread message

Joseph Mohan

unread,
Nov 19, 2015, 12:28:33 PM11/19/15
to Mezzanine Users
I'm trying to override the change_list.html template (to add a button) for a custom app (my_cms)

If i get the code from django's admin 'contrib/admin/templates/admin/change_list.html to override it messes up mezzanines beautiful template.. 
I can't find mezzanine's (or grappelli's?) equivalent. 
throws an error ''grp_tags' is not a valid tag library' and i can only find the page_tree version for mezzanine '

Anyone know where it is? 

Eduardo Rivas

unread,
Nov 19, 2015, 1:04:36 PM11/19/15
to mezzani...@googlegroups.com
That is the correct template.

You need to {% extends "admin/change_list.html" %} and override the
complete object-tools block (assuming you will provide the correct
markup for the list and the default buttons). Alternatively, you can
override the object-tools-items block and simply add your own buttons as
<li> elements after {{ block.super }}.

https://github.com/stephenmcd/grappelli-safe/blob/master/grappelli_safe/templates/admin/change_list.html#L69-L82

Eduardo Rivas

unread,
Nov 19, 2015, 1:06:31 PM11/19/15
to mezzani...@googlegroups.com
Also, you were looking at the official grappelli repo. Mezzanine uses a
custom fork (grappelli-safe), which is the one I linked to in my
previous message.

Joseph Mohan

unread,
Nov 19, 2015, 1:27:49 PM11/19/15
to Mezzanine Users
You sir are a gentleman!. thanks, exactly what i was looking for

Danny

unread,
Nov 19, 2015, 2:52:40 PM11/19/15
to mezzani...@googlegroups.com
+1

This is exactly what I did the other day to override the template only
for one particular model. You can specify the templates used for model admin
within the ModelAdmin class you create. Worked like a charm :)
https://docs.djangoproject.com/en/1.8/ref/contrib/admin/#custom-template-options

Seeya. Danny.

Reply all
Reply to author
Forward
0 new messages