summaryrefslogtreecommitdiff
path: root/django
diff options
context:
space:
mode:
authorAljaž Košir <aljazkosir5@gmail.com>2021-09-30 12:07:50 +0200
committerMariusz Felisiak <felisiak.mariusz@gmail.com>2021-09-30 12:09:24 +0200
commit0a49276065575867fbbf279f138b399c535e3b6d (patch)
treea6f89ad632a2f40f19f4232b1d9c1d38227db4d3 /django
parent93a42d43a6995993b9bbcb743ab3c2a2b8414ebd (diff)
[4.0.x] Fixed #33155 -- Made ModelChoiceIteratorValue instances hashable.
Backport of 7b8beeee3d45cafd7bec7ff3ee0e4371e142c36d from main
Diffstat (limited to 'django')
-rw-r--r--django/forms/models.py3
1 files changed, 3 insertions, 0 deletions
diff --git a/django/forms/models.py b/django/forms/models.py
index 5dcf923c12..7effb202e3 100644
--- a/django/forms/models.py
+++ b/django/forms/models.py
@@ -1166,6 +1166,9 @@ class ModelChoiceIteratorValue:
def __str__(self):
return str(self.value)
+ def __hash__(self):
+ return hash(self.value)
+
def __eq__(self, other):
if isinstance(other, ModelChoiceIteratorValue):
other = other.value