Fixed #6166: Improved example of autoescaping with template inheritance. Based on a patch from PJCrosier.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@7299 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
75617ef69f
commit
df225aee18
|
@ -429,8 +429,9 @@ all block tags. For example::
|
||||||
# base.html
|
# base.html
|
||||||
|
|
||||||
{% autoescape off %}
|
{% autoescape off %}
|
||||||
<h1>{% block title %}</h1>
|
<h1>{% block title %}{% endblock %}</h1>
|
||||||
{% block content %}
|
{% block content %}
|
||||||
|
{% endblock %}
|
||||||
{% endautoescape %}
|
{% endautoescape %}
|
||||||
|
|
||||||
|
|
||||||
|
@ -438,10 +439,11 @@ all block tags. For example::
|
||||||
|
|
||||||
{% extends "base.html" %}
|
{% extends "base.html" %}
|
||||||
{% block title %}This & that{% endblock %}
|
{% block title %}This & that{% endblock %}
|
||||||
{% block content %}<b>Hello!</b>{% endblock %}
|
{% block content %}{{ greeting }}{% endblock %}
|
||||||
|
|
||||||
Because auto-escaping is turned off in the base template, it will also be
|
Because auto-escaping is turned off in the base template, it will also be
|
||||||
turned off in the child template, resulting in the following rendered HTML::
|
turned off in the child template, resulting in the following rendered
|
||||||
|
HTML when the ``greeting`` variable contains the string ``<b>Hello!</b>``::
|
||||||
|
|
||||||
<h1>This & that</h1>
|
<h1>This & that</h1>
|
||||||
<b>Hello!</b>
|
<b>Hello!</b>
|
||||||
|
|
Loading…
Reference in New Issue