app/templates/{various top-level templates}
app/templates/help/help_base.html
app/templates/help/particular_help.html
In particular_help.html I have to use
{% extends "help/help_base.html" %}
rather than a relative
{% extends "help_base.html" %}
Is there some easy workaround for this since they're in the same
directory? Is this a desirable effect? I haven't delved into
the murky corners of the template engine to know the
scope/difficulty of such a change (and what else might break from
it).
I'd prefer not to go back and touch each of these templates with
the whims of management changing my directory layout or naming
scheme. I can survive for now with putting the path relative to
the templates/ directory, but it would be a nice-to-have in my book.
-tkc
All template loading uses the same resolving method. Essentially this is
analogous to using absolute paths for file system addressing. The
reasoning behind this is that it means you can include templates from
other applications or even a application-independent template directory
without any special notation. Yes, sometimes this bites because you
would prefer to have the relative import path method, but it's difficult
to reconcile the two ways now (it could be done by forcing absolute
paths to start with a leading slash, but that would break every single
template in existence, so not a very practical solution).
Having a quick glance at the code, I'm not sure this can be easily
simulated using a custom template tag, either. The difficulty is that
although a template object carries it's own name around with it, it
doesn't store the disk file location (in cases where that makes sense).
So working out what directory to start from for a relative path search
is not possible, as far as I can see, although I might be overlooking
something.
Regards,
Malcolm
Malcom,
Thanks for taking the time to dig into the right areas to uncover
possible difficulties with this. I hadn't considered templates
that weren't stored in non-files (possibly in either source-code
or in a DB) where "relative" and "filepath" are terms that don't
make a great deal of sense. For the time being, I'll stick with
fixed paths. Perhaps something for Django 2.0 ;)
Thanks again,
-tkc