From 6a7495051304d75865add6ff96422018984e1663 Mon Sep 17 00:00:00 2001 From: Shivang Bharadwaj Date: Thu, 29 Dec 2016 02:33:20 +0530 Subject: Fixed #27258 -- Prohibited django.Template.render() with non-dict context. Thanks Shivang Bharadwaj for the initial patch. --- django/template/context.py | 2 ++ 1 file changed, 2 insertions(+) (limited to 'django/template') diff --git a/django/template/context.py b/django/template/context.py index 134aac4b36..166f60fe75 100644 --- a/django/template/context.py +++ b/django/template/context.py @@ -281,6 +281,8 @@ def make_context(context, request=None, **kwargs): """ Create a suitable Context from a plain dict and optionally an HttpRequest. """ + if context is not None and not isinstance(context, dict): + raise TypeError('context must be a dict rather than %s.' % context.__class__.__name__) if request is None: context = Context(context, **kwargs) else: -- cgit v1.3