summaryrefslogtreecommitdiff
path: root/django
diff options
context:
space:
mode:
authorTim Graham <timograham@gmail.com>2017-03-25 08:22:12 -0400
committerGitHub <noreply@github.com>2017-03-25 08:22:12 -0400
commite643ba8bcf0b1da517cbab689ac157ee031202a3 (patch)
tree6d3a1adde6ddd9c621ac722f606257f7ed8b1f74 /django
parentf42c7cc87baa83000624fadc1e434c44efc1fba8 (diff)
Fixed #27956 -- Fixed display of errors in an {% extends %} child.
Thanks Ling-Xiao Yang for the report and test, and Preston Timmons for the fix.
Diffstat (limited to 'django')
-rw-r--r--django/template/context.py8
-rw-r--r--django/template/loader_tags.py3
2 files changed, 7 insertions, 4 deletions
diff --git a/django/template/context.py b/django/template/context.py
index 8cb82ed80f..f0435b7e8c 100644
--- a/django/template/context.py
+++ b/django/template/context.py
@@ -203,15 +203,17 @@ class RenderContext(BaseContext):
return self.dicts[-1][key]
@contextmanager
- def push_state(self, template):
+ def push_state(self, template, isolated_context=True):
initial = self.template
self.template = template
- self.push()
+ if isolated_context:
+ self.push()
try:
yield
finally:
self.template = initial
- self.pop()
+ if isolated_context:
+ self.pop()
class RequestContext(Context):
diff --git a/django/template/loader_tags.py b/django/template/loader_tags.py
index d043e5eb52..0f70a39655 100644
--- a/django/template/loader_tags.py
+++ b/django/template/loader_tags.py
@@ -151,7 +151,8 @@ class ExtendsNode(Node):
# Call Template._render explicitly so the parser context stays
# the same.
- return compiled_parent._render(context)
+ with context.render_context.push_state(compiled_parent, isolated_context=False):
+ return compiled_parent._render(context)
class IncludeNode(Node):