From fe92f0dd0d4c587eed000c7de611ddbff241bd6a Mon Sep 17 00:00:00 2001 From: Ivan Studinsky Date: Mon, 10 Jun 2024 13:19:06 +0700 Subject: [PATCH] Add `__hash__` method for `permissions.OperandHolder` class (#9417) `OperandHolder` is not hashable, so need to add `__hash__` method --- rest_framework/permissions.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/rest_framework/permissions.py b/rest_framework/permissions.py index 71de226f98..7c15eca589 100644 --- a/rest_framework/permissions.py +++ b/rest_framework/permissions.py @@ -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):