Skip to content

Commit

Permalink
Add __hash__ method for permissions.OperandHolder class (#9417)
Browse files Browse the repository at this point in the history
`OperandHolder` is not hashable, so need to add `__hash__` method
  • Loading branch information
vanya909 committed Jun 10, 2024
1 parent fbdab09 commit fe92f0d
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions rest_framework/permissions.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,9 @@ def __eq__(self, other):
self.op2_class == other.op2_class
)

def __hash__(self):
return hash((self.operator_class, self.op1_class, self.op2_class))


class AND:
def __init__(self, op1, op2):
Expand Down

0 comments on commit fe92f0d

Please sign in to comment.