views:

28

answers:

1

Hi, I have a little problem with the context.

I have an inclusion tag with the param :

takes_context=True 

In this inclusion's tag's template, I call for another inclusion_tag which has also the param

takes_context = True

But in this last inclusion_tag context is None.

I don't know why ?

Thanks.

A: 

Don't forget that the context for the second inclusion tag is whatever is returned from the first one. If you need the entire context from the original template, it's best to copy it over:

@register.inclusion_tag('template.html', takes_context=True)
def first_inclusion_tag(context, value):
    params = {'value': value}
    params.update(context)
    return params
Daniel Roseman