django templates: {% with %} variables blank inside of {% block %} within the {% with %} -


edit: i've rewritten test case absolutely minimal: file 'test.html':

{% extends "testbase.html" %} {% greeting="hi" %}   {% block content %} {{ greeting }} {% endblock %} {% endwith %} 

file 'testbase.html':

<html>   <body>     {% block content %} {% endblock %}   </body> </html> 

this produces following html output when test.html rendered:

<html>   <body>    </body> </html> 

when nesting of with , block content reversed with inside, "hi" rendered. there problem templates? sort of problem cause this? how can 1 go diagnosing this? i'm running django 1.6.1 on python python 2.7.6 (default, nov 10 2013, 19:24:18) [msc v.1500 32 bit (intel)] on win32

it looks it's not supposed work that, django-users question mine (below). basically, appears child template block contents evaluated in context of parent template. if put with statement in parent template, , {{greeting}} in child block contents, "hi" appears.

i don't think you're describing has {% %} tag specifically. you're dealing child template here -- 1 starts {% extends %} tag. nothing placed outside of {% block %} tags in child template has effect on rendered template. child template supplies block contents override has been specified in parent template, in child template must included inside {% block %} tags. (if not specified inside {% block %}, should go in parent template?) see:

http://docs.djangoproject.com/en/dev/topics/templates/#id1


Comments

Popular posts from this blog

searchKeyword not working in AngularJS filter -

sequelize.js - Sequelize: sort by enum cases -

user interface - how to replace an ongoing process of image capture from another process call over the same ImageLabel in python's GUI TKinter -