On 2/22/07, Iwan <[EMAIL PROTECTED]> wrote:
...
>
> But this means that when you write B, you need to already know which
> template it will extend.

Yes.

...
> In other words, I'd like to write B before I have any knowledge about
> which other template it's going to extend.  And, at run time I want to
> sometimes use it "inside" A, and other times inside another, say C.
>
> Is something like this possible?

Yes, if you don't mind doing a bit of juggling.

from django.template import loader

source, origin = loader.find_template_source('B',
dirs=['/dir/to/dynamic/a/','/dir/to/b/'])
template = get_template_from_string(source, origin, template_name)

You'd always call the parent template "A", but vary the dirs the
loader looks in to find different templates named "A".

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to [email protected]
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