Code

Opened 7 years ago

Closed 7 years ago

Last modified 7 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
Component: Template system Version: master
Severity: Keywords: extends
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

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.

Attachments (0)

Change History (2)

comment:1 Changed 7 years ago by ubernostrum

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Resolution set to worksforme
  • Status changed from new to closed

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 Changed 7 years ago by anonymous

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!

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.