Django

Code

Show
Ignore:
Timestamp:
03/18/08 13:41:52 (4 months ago)
Author:
ubernostrum
Message:

Fixed #6166: Improved example of autoescaping with template inheritance. Based on a patch from PJCrosier.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • django/trunk/docs/templates.txt

    r7294 r7299  
    430430 
    431431    {% autoescape off %} 
    432     <h1>{% block title %}</h1> 
     432    <h1>{% block title %}{% endblock %}</h1> 
    433433    {% block content %} 
     434    {% endblock %} 
    434435    {% endautoescape %} 
    435436 
     
    439440    {% extends "base.html" %} 
    440441    {% block title %}This & that{% endblock %} 
    441     {% block content %}<b>Hello!</b>{% endblock %} 
     442    {% block content %}{{ greeting }}{% endblock %} 
    442443 
    443444Because auto-escaping is turned off in the base template, it will also be 
    444 turned off in the child template, resulting in the following rendered HTML:: 
     445turned off in the child template, resulting in the following rendered 
     446HTML when the ``greeting`` variable contains the string ``<b>Hello!</b>``:: 
    445447 
    446448    <h1>This & that</h1>