From df225aee18176e9997d102185bc490a52b31e2fc Mon Sep 17 00:00:00 2001 From: James Bennett Date: Tue, 18 Mar 2008 18:41:52 +0000 Subject: [PATCH] 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 --- docs/templates.txt | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/docs/templates.txt b/docs/templates.txt index 3360b04178..ea9f3fb6b2 100644 --- a/docs/templates.txt +++ b/docs/templates.txt @@ -429,8 +429,9 @@ all block tags. For example:: # base.html {% autoescape off %} -

{% block title %}

+

{% block title %}{% endblock %}

{% block content %} + {% endblock %} {% endautoescape %} @@ -438,10 +439,11 @@ all block tags. For example:: {% extends "base.html" %} {% block title %}This & that{% endblock %} - {% block content %}Hello!{% 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 ``Hello!``::

This & that

Hello!