summaryrefslogtreecommitdiff
path: root/django
diff options
context:
space:
mode:
authorAnubhav Joshi <anubhav9042@gmail.com>2014-07-13 14:28:36 +0530
committerTim Graham <timograham@gmail.com>2014-07-24 14:22:19 -0400
commitb1abfb3c59467d0bb088e19be76fc42fcb570835 (patch)
tree7078516079ca9a33ac350c0539d510d4ebfeab38 /django
parent5f919b9c81a26832f98033335a601ec1ca718db7 (diff)
Fixed #21707 -- Added helpful error message when using {{ block.super }} in base template.
Thanks mitar for the suggestion.
Diffstat (limited to 'django')
-rw-r--r--django/template/loader_tags.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/django/template/loader_tags.py b/django/template/loader_tags.py
index 77508a7663..1480e5e193 100644
--- a/django/template/loader_tags.py
+++ b/django/template/loader_tags.py
@@ -68,6 +68,11 @@ class BlockNode(Node):
return result
def super(self):
+ if not hasattr(self, 'context'):
+ raise TemplateSyntaxError(
+ "'%s' object has no attribute 'context'. Did you use "
+ "{{ block.super }} in a base template?" % self.__class__.__name__
+ )
render_context = self.context.render_context
if (BLOCK_CONTEXT_KEY in render_context and
render_context[BLOCK_CONTEXT_KEY].get_block(self.name) is not None):