summaryrefslogtreecommitdiff
path: root/django/template
diff options
context:
space:
mode:
Diffstat (limited to 'django/template')
-rw-r--r--django/template/context.py10
1 files changed, 4 insertions, 6 deletions
diff --git a/django/template/context.py b/django/template/context.py
index 8f349a3a96..f0a0cf2a00 100644
--- a/django/template/context.py
+++ b/django/template/context.py
@@ -124,12 +124,10 @@ class BaseContext:
"""
Compare two contexts by comparing theirs 'dicts' attributes.
"""
- return (
- isinstance(other, BaseContext) and
- # because dictionaries can be put in different order
- # we have to flatten them like in templates
- self.flatten() == other.flatten()
- )
+ if not isinstance(other, BaseContext):
+ return NotImplemented
+ # flatten dictionaries because they can be put in a different order.
+ return self.flatten() == other.flatten()
class Context(BaseContext):