summaryrefslogtreecommitdiff
path: root/django/forms
diff options
context:
space:
mode:
authorMadalin Popa <contact@madalinpopa.com>2024-06-08 14:57:27 +0200
committerSarah Boyce <42296566+sarahboyce@users.noreply.github.com>2024-06-13 16:21:53 +0200
commitd28626ecf8bd340084ed70ff2d88e8dbab001e2c (patch)
tree905bb6267123c052332a005bc32cbbc72085aaf7 /django/forms
parent2a32b233822683c51e59722b7c9aa0789fc4ab1b (diff)
Fixed #35488 -- Fixed BaseModelFormSet.validate_unique() crash due to unhashable type.
Diffstat (limited to 'django/forms')
-rw-r--r--django/forms/models.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/django/forms/models.py b/django/forms/models.py
index 4cda4e534e..09be448984 100644
--- a/django/forms/models.py
+++ b/django/forms/models.py
@@ -23,6 +23,7 @@ from django.forms.widgets import (
SelectMultiple,
)
from django.utils.choices import BaseChoiceIterator
+from django.utils.hashable import make_hashable
from django.utils.text import capfirst, get_text_list
from django.utils.translation import gettext
from django.utils.translation import gettext_lazy as _
@@ -834,8 +835,8 @@ class BaseModelFormSet(BaseFormSet, AltersData):
(
d._get_pk_val()
if hasattr(d, "_get_pk_val")
- # Prevent "unhashable type: list" errors later on.
- else tuple(d) if isinstance(d, list) else d
+ # Prevent "unhashable type" errors later on.
+ else make_hashable(d)
)
for d in row_data
)