From 73e7bfc8f51a68c89c4dacc7bd52072bebcabb2c Mon Sep 17 00:00:00 2001 From: Hasan Ramezani Date: Sun, 27 Dec 2020 21:21:59 +0100 Subject: [3.2.x] Fixed #32290 -- Fixed TemplateNotFound in {% include %} tag for relative path in variable. Backport of c978dd93fda87c6d2e965d385164c35f1a3e64b8 from master --- tests/template_tests/relative_templates/dir1/dir2/inc3.html | 1 + tests/template_tests/test_extends_relative.py | 6 ++++++ 2 files changed, 7 insertions(+) create mode 100644 tests/template_tests/relative_templates/dir1/dir2/inc3.html (limited to 'tests/template_tests') diff --git a/tests/template_tests/relative_templates/dir1/dir2/inc3.html b/tests/template_tests/relative_templates/dir1/dir2/inc3.html new file mode 100644 index 0000000000..7a8374df51 --- /dev/null +++ b/tests/template_tests/relative_templates/dir1/dir2/inc3.html @@ -0,0 +1 @@ +{% include tmpl %} diff --git a/tests/template_tests/test_extends_relative.py b/tests/template_tests/test_extends_relative.py index 12324f0df6..f797ae1a1a 100644 --- a/tests/template_tests/test_extends_relative.py +++ b/tests/template_tests/test_extends_relative.py @@ -64,6 +64,12 @@ class IncludeRelativeBehaviorTests(SimpleTestCase): output = template.render(Context({})) self.assertEqual(output.strip(), 'dir2 include') + def test_normal_include_variable(self): + engine = Engine(dirs=[RELATIVE]) + template = engine.get_template('dir1/dir2/inc3.html') + output = template.render(Context({'tmpl': './include_content.html'})) + self.assertEqual(output.strip(), 'dir2 include') + def test_dir2_include(self): engine = Engine(dirs=[RELATIVE]) template = engine.get_template('dir1/dir2/inc1.html') -- cgit v1.3