On Tue, 2007-03-27 at 17:13 -0500, Tim Chase wrote:
> I have a directory structure like
> 
> 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.

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


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to