Colin Howlett wrote:
> Robert,
> 
> Thanks again. I can see how I can acheive what I want to acheive with
> simple_tag.
> 
> I'm not sure that I understand your first example though.
> 
> Is the list of url patterns passed as parameters to inclusion_tag
> supposed to be searched for a match to decide which template to use?
> 
> It seems I have to pass the values to complete the patterns in the
> context. I'm not sure I understand how I'm supposed to get them there -
> through the view of  the parent page? from a separate template tag?
> 
> It all seems kind of complicated - which given the elegance of what
> you've produced so far, suggests I've misunderstood something. In
> short, I'm confused. Would you care to elaborate?
> 
> Thanks.

I was suggesting future extensions, not something that works currently.
Basically the idea was that you get 'some' information in your
arguments, and use that information to generate a context which will be
used *both* to resolve the template, and to render it. Clearly, you
could just pass the whole template name as an argument - eg here is a
version of include with this hypothetical system (which doesn't pass
through the context from its caller).

@register.inclusion_tag('%(name)s'):
def include(context, name):
    return {'name', name}

This is a future direction, not something that would work right now.

Reply via email to