diff options
| author | Demur Nodia <demur.nodia@gmail.com> | 2018-05-27 13:06:37 +0300 |
|---|---|---|
| committer | Tim Graham <timograham@gmail.com> | 2018-07-30 16:52:12 -0400 |
| commit | 06a11ef6ecf324db0a1530b8cca727883698f442 (patch) | |
| tree | b627c9f8f48f8f547c0ddda80e4d7cbe1c3653e1 /django/forms | |
| parent | c090ea97c1a199af13c23e83883fbb18598b49fe (diff) | |
Fixed #26819 -- Fixed BaseModelFormSet.validate_unique() "unhashable type: list" crash.
Diffstat (limited to 'django/forms')
| -rw-r--r-- | django/forms/models.py | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/django/forms/models.py b/django/forms/models.py index 7f5e2544dd..aa35ef5f92 100644 --- a/django/forms/models.py +++ b/django/forms/models.py @@ -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: |
