From 630c0f740d87c2193333d00fa2f3d35ed57f056a Mon Sep 17 00:00:00 2001 From: Ivan Studinsky Date: Thu, 30 May 2024 10:58:57 +0700 Subject: [PATCH] Add `__hash__` method for `permissions.OperandHolder` class `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):