Skip to content

Commit fe92f0d

Browse files
authored
Add __hash__ method for permissions.OperandHolder class (encode#9417)
`OperandHolder` is not hashable, so need to add `__hash__` method
1 parent fbdab09 commit fe92f0d

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

rest_framework/permissions.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,9 @@ def __eq__(self, other):
5454
self.op2_class == other.op2_class
5555
)
5656

57+
def __hash__(self):
58+
return hash((self.operator_class, self.op1_class, self.op2_class))
59+
5760

5861
class AND:
5962
def __init__(self, op1, op2):

0 commit comments

Comments
 (0)