I wrote a custom base_site.html with some common code for all my projects.
Now I need an app to add a single template_tag in a block. Is it
possible without copying ALL the previous base_site?
I cannot change the name of the parent template, or admin will not use
it when I don't install that app.
I moved
YOURPROJECT/templates/admin/base_site.html
to
YOURPROJECT/templates/admin/_base_site.html
and created an empty
YOURPROJECT/templates/admin/base_site.html
with only
{% extends "_base_site.html" %}
but it's not clean.
Is there any other cleaner way to do that?
--
Alessandro Ronchi
http://www.soasi.com
Hobby & Giochi
http://hobbygiochi.com
http://www.facebook.com/hobbygiochi
I'm not sure if it's what you want, but... I've got a base ui
application with a ui/base.html. Several blocks for the title, logo,
the sidebar, footer, javascript, etc.
Several applications extend that base template. But multiple sites also
want to extend it to change the global logo and footer... The sites
effectively have to override the base template.
The solution: in my ui project I have a ui/realbase.html that is
extended by ui/base.html. The only code in ui/base.html is the
"extends" line! So overriding that one is inexpensive.
The other applications can happily extend ui/base.html and fill in the
blocks that are really from ui/realbase.html. And my site can override
ui/base.html and fill in the logo block and the footer block (which are
normally not touched by the applications).
I hope I'm clear enough without a code example. The code, should you
want to take a look, is at http://pypi.python.org/pypi/lizard-ui
Reinout
--
Reinout van Rees - rei...@vanrees.org - http://reinout.vanrees.org
Programmer at http://www.nelen-schuurmans.nl
"Military engineers build missiles. Civil engineers build targets"
> The solution: in my ui project I have a ui/realbase.html that is extended by
> ui/base.html. The only code in ui/base.html is the "extends" line! So
> overriding that one is inexpensive.
I've used the same solution, but it would be nice to have a tag to
enable those extends without empty templates, for DRY principle and
because usually you don't want to change a library template at all,
and with this you have to move to realbase.html.