summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorJannis Leidel <jannis@leidel.info>2011-06-11 16:22:45 +0000
committerJannis Leidel <jannis@leidel.info>2011-06-11 16:22:45 +0000
commit0ebaf10258bf9fad4d540025a6eb3a8c471b284c (patch)
treec060039fe93efe103af380d5e1154be19775942e /docs
parentd27f909d2e8e215dc9c52d090cee393a719a7965 (diff)
Fixed #11989 -- Allow passing a Template instance to inclusion_tag. Thanks to Jeremy Dunck and tcoenen.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@16374 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'docs')
-rw-r--r--docs/howto/custom-template-tags.txt9
1 files changed, 9 insertions, 0 deletions
diff --git a/docs/howto/custom-template-tags.txt b/docs/howto/custom-template-tags.txt
index 97f1e9a53b..1e226840d6 100644
--- a/docs/howto/custom-template-tags.txt
+++ b/docs/howto/custom-template-tags.txt
@@ -822,6 +822,15 @@ loader, we'd register the tag like this::
# Here, register is a django.template.Library instance, as before
register.inclusion_tag('results.html')(show_results)
+.. versionchanged:: 1.4
+
+ Alternatively it is possible to register the inclusion tag using a
+ :class:`django.template.Template` instance::
+
+ from django.template.loader import get_template
+ t = get_template('results.html')
+ register.inclusion_tag(t)(show_results)
+
As always, decorator syntax works as well, so we could have written::
@register.inclusion_tag('results.html')