Opened 17 years ago

Closed 17 years ago

Last modified 17 years ago

#5344 closed (worksforme)

template loading doesn't work for extends (eg admin/base.html) [& tutorial needs updating?]

Reported by: anonymous Owned by: Adrian Holovaty
Component: Template system Version: dev
Severity: Keywords: extends
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

I'm following the tutorial and want to customise the site title and remove the 'Documentation' link in the Admin interface.

I can customise base_site.html by copying it into my templates directory as directed. It extends 'base.html'. Now, if I also copy base.html to the same my_templates/admin directory, it does NOT get found by the template loader (it picks up the site-packages version)! Surely this is a template loader bug?

As an alternative, I tried defining the 'userlinks' block in my new base_site.html and this works for the front admin page, but not the others (I understand that this is because other templates are being used, but from a tutorial perspective this gets complicated!)

I've had this in the past, and think I solved it by hacking the installed source in site-packages (with 0.95). I'm now using the latest svn dev version.

One quick solution would be to remove the Documentation link altogether (or make it optional in some way, especially as it doesn't work 'out of the box' (as it requires docutils to be installed).

Thanks for your help and the great product!! :) - Tushar.

Change History (2)

comment:1 by James Bennett, 17 years ago

Resolution: worksforme
Status: newclosed

You'll probably want to read up on template loaders and, especially, putting them in the right order to ensure your custom templates are found before those distributed with an application.

comment:2 by anonymous, 17 years ago

Thanks, I've figured out what was going on now. The base.html file WAS being loaded (where I'd deleted the Documentation link), but I was still seeing the link appear on non-home pages (which confused me).

The problem was that the definition of the 'userlinks' block (which includes Documentation) was *repeated* in change_form.html, change_list.html, delete_confirmation. and object_history.html! Therefore, my change in base.html was being overridden by these forms :(

I'd recommend that these other templates are re-factored to remove the duplication so that simple people like me have an easier time of cutomisation, and only have to change things in one place rather than 5!

Note: See TracTickets for help on using tickets.
Back to Top