Permalink
Browse files

Fixed #6166: Improved example of autoescaping with template inheritan…

…ce. Based on a patch from PJCrosier.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@7299 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
1 parent 75617ef commit df225aee18176e9997d102185bc490a52b31e2fc @ubernostrum ubernostrum committed Mar 18, 2008
Showing with 5 additions and 3 deletions.
  1. +5 −3 docs/templates.txt
View
8 docs/templates.txt
@@ -429,19 +429,21 @@ all block tags. For example::
# base.html
{% autoescape off %}
- <h1>{% block title %}</h1>
+ <h1>{% block title %}{% endblock %}</h1>
{% block content %}
+ {% endblock %}
{% endautoescape %}
# child.html
{% extends "base.html" %}
{% 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
-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>
<b>Hello!</b>

0 comments on commit df225ae

Please sign in to comment.