From 5cdacbda034af928f5033c9afc7b50ee0b13f75c Mon Sep 17 00:00:00 2001 From: Curtis Maloney Date: Wed, 28 Aug 2013 22:17:20 +1000 Subject: Fixed #17356 -- Allowed {% include %} to render compiled templates Reviewed by Loic Bistuer and Tim Graham. --- django/template/loader_tags.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'django') diff --git a/django/template/loader_tags.py b/django/template/loader_tags.py index d48f85eb35..224efe884b 100644 --- a/django/template/loader_tags.py +++ b/django/template/loader_tags.py @@ -159,8 +159,11 @@ class IncludeNode(BaseIncludeNode): def render(self, context): try: - template_name = self.template_name.resolve(context) - template = get_template(template_name) + template = self.template_name.resolve(context) + # Does this quack like a Template? + if not callable(getattr(template, 'render', None)): + # If not, we'll try get_template + template = get_template(template) return self.render_template(template, context) except: if settings.TEMPLATE_DEBUG: -- cgit v1.3