Code

Ticket #13745: template_extends_select_multi.2.diff

File template_extends_select_multi.2.diff, 946 bytes (added by gauss, 4 years ago)
Line 
1Index: django/template/loader_tags.py
2===================================================================
3--- django/template/loader_tags.py      (revision 13350)
4+++ django/template/loader_tags.py      (working copy)
5@@ -1,6 +1,6 @@
6 from django.template import TemplateSyntaxError, TemplateDoesNotExist, Variable
7 from django.template import Library, Node, TextNode
8-from django.template.loader import get_template
9+from django.template.loader import get_template, select_template
10 from django.conf import settings
11 from django.utils.safestring import mark_safe
12 
13@@ -97,7 +97,7 @@
14             raise TemplateSyntaxError(error_msg)
15         if hasattr(parent, 'render'):
16             return parent # parent is a Template object
17-        return get_template(parent)
18+        return select_template(parent) if isinstance(parent, (list, tuple)) else get_template(parent)
19 
20     def render(self, context):
21         compiled_parent = self.get_parent(context)