Django: cannot pass variable to included template?

Posted by duy on Stack Overflow See other posts from Stack Overflow or by duy
Published on 2010-12-26T10:46:30Z Indexed on 2010/12/26 10:54 UTC
Read the original article Hit count: 264

Hi,

I got a problem where I want to use template including in Django.

Here is the real example: I got 3 file: home.html (will get the context variable passed from Views), base.html (the skeleton template file) and the header.html (included by base.html).

If if put the code below directly in base.html without including the header.html, the {{title}} variable passing from home is correctly called. But if I include the header.html in base.html, the {{title}} variable's value cannot be called.

<title>{% block title %}{% endblock %} | {{ SITE_INFO_TITLE }}</title>

Is there any solution to this problem? Thanks.

© Stack Overflow or respective owner

Related posts about django

Related posts about templates