Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

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...
commit df225aee18176e9997d102185bc490a52b31e2fc 1 parent 75617ef
James Bennett authored March 18, 2008

Showing 1 changed file with 5 additions and 3 deletions. Show diff stats Hide diff stats

  1. 8  docs/templates.txt
8  docs/templates.txt
@@ -429,8 +429,9 @@ all block tags. For example::
429 429
     # base.html
430 430
 
431 431
     {% autoescape off %}
432  
-    <h1>{% block title %}</h1>
  432
+    <h1>{% block title %}{% endblock %}</h1>
433 433
     {% block content %}
  434
+    {% endblock %}
434 435
     {% endautoescape %}
435 436
 
436 437
 
@@ -438,10 +439,11 @@ all block tags. For example::
438 439
 
439 440
     {% extends "base.html" %}
440 441
     {% block title %}This & that{% endblock %}
441  
-    {% block content %}<b>Hello!</b>{% endblock %}
  442
+    {% block content %}{{ greeting }}{% endblock %}
442 443
 
443 444
 Because 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::
  445
+turned off in the child template, resulting in the following rendered
  446
+HTML when the ``greeting`` variable contains the string ``<b>Hello!</b>``::
445 447
 
446 448
     <h1>This & that</h1>
447 449
     <b>Hello!</b>

0 notes on commit df225ae

Please sign in to comment.
Something went wrong with that request. Please try again.