The 'fix' is to change
[https://github.com/django/django/blob/5cdacbda034af928f5033c9afc7b50ee0b13f75c/django/template/loader_tags.py#L166
this line] from `get_template` to `select_template`, though this might now
be slightly complicated by the recent changes in
5cdacbda034af928f5033c9afc7b50ee0b13f75c to allow for rendering of
`Template` instances.
Changing to `select_template` on 1.4 yields the results I'd expect:
{{{
>>> from django.template import Template, Context
>>> tmpl = Template('{% include var %}')
>>> ctx = Context({'var':['admin/base.html', 'admin/fail.html']})
>>> tmpl.render(ctx)
... some HTML output ...
}}}
Both the above shell sessions assume `django.contrib.admin` is in
INSTALLED_APPS.
--
Ticket URL: <https://code.djangoproject.com/ticket/20995>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
* owner: nobody => amberdoctor
* status: new => assigned
* needs_docs: => 0
* needs_tests: => 0
* needs_better_patch: => 0
--
Ticket URL: <https://code.djangoproject.com/ticket/20995#comment:1>
Comment (by Keryn Knight <django@…>):
I now have a working patch + test for this, but because it introduces
another slightly different way of selecting a template based on the given
arguments, I'm holding off on opening a PR, to see if there's merit to
refactoring template selection into one place; see #21065 for the details.
--
Ticket URL: <https://code.djangoproject.com/ticket/20995#comment:2>
* stage: Unreviewed => Accepted
--
Ticket URL: <https://code.djangoproject.com/ticket/20995#comment:3>
* stage: Unreviewed => Accepted
--
Ticket URL: <https://code.djangoproject.com/ticket/20995#comment:3>
Comment (by EvilDMP):
I agree that this should follow upon a resolution of #21065. Three
different ways of selecting templates seems like two too many already.
--
Ticket URL: <https://code.djangoproject.com/ticket/20995#comment:4>
* easy: 1 => 0
--
Ticket URL: <https://code.djangoproject.com/ticket/20995#comment:5>
* needs_docs: 0 => 1
* has_patch: 0 => 1
Comment:
Tried to solve this. [https://github.com/django/django/pull/12407 PR]
--
Ticket URL: <https://code.djangoproject.com/ticket/20995#comment:6>
* needs_better_patch: 0 => 1
* needs_docs: 1 => 0
--
Ticket URL: <https://code.djangoproject.com/ticket/20995#comment:7>
* owner: amberdoctor => KESHAV KUMAR
--
Ticket URL: <https://code.djangoproject.com/ticket/20995#comment:8>
* needs_better_patch: 1 => 0
--
Ticket URL: <https://code.djangoproject.com/ticket/20995#comment:9>
* status: assigned => closed
* resolution: => fixed
Comment:
In [changeset:"f37d548ede290690589e86b892c4f106e2a8e1bc" f37d548]:
{{{
#!CommitTicketReference repository=""
revision="f37d548ede290690589e86b892c4f106e2a8e1bc"
Fixed #20995 -- Added support for iterables of template names to {%
include %} template tag.
Thanks Adam Johnson for the review.
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/20995#comment:10>