2007年11月13日 星期二 12:31
请教大家一个问题,如果将block嵌到ifequal里头的话,貌似是不起作用的,文档里有没有什么地方有说明这样的原因? ################## father.html ################## {% ifequal a 0 %} {% block main %} father here {% endblock main %} {% endifequal %} ################## child.html ################### {% extends "father.html" %} {% block main %} child here {% endblock main %} ############################################## >>> from django.template.loader import render_to_string >>> >>> print render_to_string('father.html', {'a': 0}) father here >>> print render_to_string('child.html', {'a': 0}) father here >>> -------------- next part -------------- An HTML attachment was scrubbed... URL: http://python.cn/pipermail/python-chinese/attachments/20071113/add63a47/attachment.htm
2007年11月13日 星期二 19:41
我昨天剛看了Djangobook, 應該只是 {% endblock %} 而不是 {% endblock main %} On Nov 12, 2007, at 11:31 PM, huang jayven wrote: > 请教大家一个问题,如果将block嵌到ifequal里头的 > 话,貌似是不起作用的,文档里有没有什么地方有 > 说明这样的原因? > > ################## father.html ################## > > > {% ifequal a 0 %} > {% block main %} > father here > {% endblock main %} > {% endifequal %} > > > > ################## child.html ################### > {% extends "father.html" %} > > {% block main %} > child here > {% endblock main %} > > ############################################## > >>> from django.template.loader import render_to_string > >>> > >>> print render_to_string('father.html', {'a': 0}) > > > > > father here > > > > > > >>> print render_to_string('child.html', {'a': 0}) > > > > > father here > > > > > > >>> > > _______________________________________________ > python-chinese > Post: send python-chinese在lists.python.cn > Subscribe: send subscribe to python-chinese-request在lists.python.cn > Unsubscribe: send unsubscribe to python-chinese- > request在lists.python.cn > Detail Info: http://python.cn/mailman/listinfo/python-chinese
2007年11月14日 星期三 14:03
ºÃÏñÕâ¸öû¹ØϵµÄ°É ÔÚ07-11-13£¬GTcoffee <gtcoffee at gmail.com> дµÀ£º > > ÎÒ×òÌì¿´ÁËDjangobook, ªÔÖ»ÊÇ {% endblock %} ¶ø²»ÊÇ {% > endblock main %} > > On Nov 12, 2007, at 11:31 PM, huang jayven wrote: > > > Çë½Ì´ó¼ÒÒ»¸öÎÊÌ⣬Èç¹û½«blockǶµ½ifequalÀïÍ·µÄ > > »°£¬Ã²ËÆÊDz»Æð×÷Óõģ¬ÎĵµÀïÓÐûÓÐʲôµØ·½ÓÐ > > ˵Ã÷ÕâÑùµÄÔÒò£¿ > > > > ################## father.html ################## > > > > > > {% ifequal a 0 %} > > {% block main %} > > father here > > {% endblock main %} > > {% endifequal %} > > > > > > > > ################## child.html ################### > > {% extends "father.html" %} > > > > {% block main %} > > child here > > {% endblock main %} > > > > ############################################## > > >>> from django.template.loader import render_to_string > > >>> > > >>> print render_to_string('father.html', {'a': 0}) > > > > > > > > > > father here > > > > > > > > > > > > >>> print render_to_string('child.html', {'a': 0}) > > > > > > > > > > father here > > > > > > > > > > > > >>> > > > > _______________________________________________ > > python-chinese > > Post: send python-chinese at lists.python.cn > > Subscribe: send subscribe to python-chinese-request at lists.python.cn > > Unsubscribe: send unsubscribe to python-chinese- > > request at lists.python.cn > > Detail Info: http://python.cn/mailman/listinfo/python-chinese > > _______________________________________________ > python-chinese > Post: send python-chinese at lists.python.cn > Subscribe: send subscribe to python-chinese-request at lists.python.cn > Unsubscribe: send unsubscribe to python-chinese-request at lists.python.cn > Detail Info: http://python.cn/mailman/listinfo/python-chinese -------------- next part -------------- An HTML attachment was scrubbed... URL: http://python.cn/pipermail/python-chinese/attachments/20071114/3bc1acdc/attachment.html
2007年11月15日 星期四 00:30
文档里没有说明,吃了亏才知道不能这么做.也许可以做为bug提交吧 On 11/13/07, huang jayven <kassarar在gmail.com> wrote: > 请教大家一个问题,如果将block嵌到ifequal里头的话,貌似是不起作用的,文档里有没有什么地方有说明这样的原因? > > ################## father.html ################## > > > {% ifequal a 0 %} > {% block main %} > father here > {% endblock main %} > {% endifequal %} > > > > ################## child.html ################### > {% extends "father.html" %} > > {% block main %} > child here > {% endblock main %} > > ############################################## > >>> from django.template.loader import render_to_string > >>> > >>> print render_to_string('father.html', {'a': 0}) > > > > > father here > > > > > > >>> print render_to_string('child.html', {'a': 0}) > > > > > father here > > > > > > >>> > -- 你的生活,我们的梦想。 好看簿:上传照片,乐趣才刚刚开始…… http://www.haokanbu.com
Zeuux © 2025
京ICP备05028076号