Ask Your Question
0

How to override or replace admin templates for own app?

asked 2013-04-08 13:10:51 -0500

Fernando gravatar image

updated 2013-04-08 13:14:12 -0500

Hi,

I'm trying to override or replace the admin templates, but I can't find how to do this.

I have created a /templates/admin/my_app/my_model directory ( as Django docs says at https://docs.djangoproject.com/en/dev/ref/contrib/admin/#overriding-admin-templates (Overriding admin templates) ), which I put it on my askbot directory and I added it to ASKBOT_EXTRA_SKINS_DIR ( http://askbot.org/en/question/207/ (reference1) and http://askbot.org/en/question/7499/askbot_extra_skins_dir-settings-stalls-model-validation/?answer=7504#post-id-7504 (reference2) ). This directory contains a modified copy of change_form.html provided by Django.

I don't know what is wrong, but it still showing the default template.

Can anyone help me? Thanks!

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2013-04-08 14:49:08 -0500

Fernando gravatar image

updated 2013-04-08 14:53:38 -0500

Hello again,

I was confused because I thought that TEMPLATE_DIRS does not work with Askbot like I had read at http://askbot.org/en/question/207/. Finally I have used the default setting from Django docs for override the admin templates:

  • Create a directory, e.g. .../template/admin/my_app/my_model and include it (only '.../templates' --> the root path of templates dir) in TEMPLATE_DIRS from settings.py.

I have left ASKBOT_TEMPLATE_EXTRA_DIR as comment.

Thanks!!

edit flag offensive delete link more

Comments

The regular mechanism using TEMPLATE_DIRS and TEPMLATE_LOADERS should work, but I have not tested on those templates.

Evgeny gravatar imageEvgeny ( 2013-04-08 15:02:31 -0500 )edit

Well, at the moment that configuration works. I'll comment here if I have more problems with this.

Fernando gravatar imageFernando ( 2013-04-08 15:10:24 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2013-04-08 13:10:51 -0500

Seen: 232 times

Last updated: Apr 08 '13