2010-10-06 17 views
1

我有一個上下文的小問題。django與幾個inclusion_tag的上下文

我有帕拉姆一個包含標籤:

takes_context=True 

在這種包容的標籤的模板,我呼籲這也帕拉姆

takes_context = True

另一個使用inclusion_tag但在這最後的使用inclusion_tag上下文是無。

我不知道爲什麼?

回答

1

不要忘記,第二個包含標記的上下文是從第一個標記返回的內容。如果您需要原始模板的整個上下文,最好複製它:

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