First time here? Check out the FAQ!
0

How to override or replace admin templates for own app?
 

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!

To enter a block of code:

  • enter empty line after your previous text
  • paste or type the code
  • select the code and press the button above
Preview: (hide)
Fernando's avatar
1
Fernando
asked 12 years ago, updated 12 years ago

Comments

see more comments

1 Answer

0

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!!

To enter a block of code:

  • enter empty line after your previous text
  • paste or type the code
  • select the code and press the button above
Preview: (hide)
Fernando's avatar
1
Fernando
answered 12 years ago, updated 12 years ago
link

Comments

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

Evgeny's avatar Evgeny (12 years ago)

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

Fernando's avatar Fernando (12 years ago)
see more comments