mirror of
https://github.com/django/django.git
synced 2025-07-19 19:25:26 +00:00
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
This commit is contained in:
parent
d27f909d2e
commit
0ebaf10258
4 changed files with 61 additions and 1 deletions
|
@ -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')
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue