Browse Source

Merge pull request #307 from justanr/Update-Make-Comparable

Fix non-assignment in make_comparable
Peter Justin 7 years ago
parent
commit
33ef7600ac
1 changed files with 5 additions and 0 deletions
  1. 5 0
      flaskbb/utils/database.py

+ 5 - 0
flaskbb/utils/database.py

@@ -19,7 +19,12 @@ def make_comparable(cls):
     def __ne__(self, other):
         return not self.__eq__(other)
 
+    def __hash__(self):
+        return hash((cls, self.id))
+
     cls.__eq__ = __eq__
+    cls.__ne__ = __ne__
+    cls.__hash__ = __hash__
     return cls