summaryrefslogtreecommitdiff
path: root/django/utils/tree.py
diff options
context:
space:
mode:
authorMariusz Felisiak <felisiak.mariusz@gmail.com>2017-09-28 18:07:19 +0200
committerTim Graham <timograham@gmail.com>2017-09-28 12:07:19 -0400
commitfc6528b25ab1834be1a478b405bf8f7ec5cf860c (patch)
treefbdf00056ceaa9017967a79276d5c2d95720a616 /django/utils/tree.py
parent44f08422c872e32854216b2b30aab119ec3bb5d8 (diff)
downloaddjango-fc6528b25ab1834be1a478b405bf8f7ec5cf860c.tar.gz
Fixed #28629 -- Made tree.Node instances hashable.
Regression in 508b5debfb16843a8443ebac82c1fb91f15da687 which added Node.__eq__().
Diffstat (limited to 'django/utils/tree.py')
-rw-r--r--django/utils/tree.py3
1 files changed, 3 insertions, 0 deletions
diff --git a/django/utils/tree.py b/django/utils/tree.py
index 392838b482..b7f7b9798b 100644
--- a/django/utils/tree.py
+++ b/django/utils/tree.py
@@ -70,6 +70,9 @@ class Node:
self.children == other.children
)
+ def __hash__(self):
+ return hash((self.__class__, self.connector, self.negated) + tuple(self.children))
+
def add(self, data, conn_type, squash=True):
"""
Combine this tree and the data represented by data using the