mirror of
https://github.com/django/django.git
synced 2025-11-07 07:15:35 +00:00
Fixed #26819 -- Fixed BaseModelFormSet.validate_unique() "unhashable type: list" crash.
This commit is contained in:
@@ -696,8 +696,12 @@ class BaseModelFormSet(BaseFormSet):
|
||||
for field in unique_check if field in form.cleaned_data
|
||||
)
|
||||
# Reduce Model instances to their primary key values
|
||||
row_data = tuple(d._get_pk_val() if hasattr(d, '_get_pk_val') else d
|
||||
for d in row_data)
|
||||
row_data = tuple(
|
||||
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 for d in row_data
|
||||
)
|
||||
if row_data and None not in row_data:
|
||||
# if we've already seen it then we have a uniqueness failure
|
||||
if row_data in seen_data:
|
||||
|
||||
Reference in New Issue
Block a user