1
0
mirror of https://github.com/django/django.git synced 2025-10-24 06:06:09 +00:00

[3.2.x] Fixed #32290 -- Fixed TemplateNotFound in {% include %} tag for relative path in variable.

Backport of c978dd93fd from master
This commit is contained in:
Hasan Ramezani
2020-12-27 21:21:59 +01:00
committed by Mariusz Felisiak
parent 4dbbe37479
commit 73e7bfc8f5
3 changed files with 19 additions and 4 deletions

View File

@@ -0,0 +1 @@
{% include tmpl %}

View File

@@ -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')