mirror of
https://github.com/django/django.git
synced 2025-10-24 22:26:08 +00:00
Fixed #13811 -- Changed unique validation in model formsets to ignore None values, not just omit them
git-svn-id: http://code.djangoproject.com/svn/django/trunk@14193 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
@@ -526,10 +526,9 @@ class BaseModelFormSet(BaseFormSet):
|
||||
# it's already invalid
|
||||
if not hasattr(form, "cleaned_data"):
|
||||
continue
|
||||
# get each of the fields for which we have data on this form
|
||||
if [f for f in unique_check if f in form.cleaned_data and form.cleaned_data[f] is not None]:
|
||||
# get the data itself
|
||||
row_data = tuple([form.cleaned_data[field] for field in unique_check])
|
||||
# get data for each field of each of unique_check
|
||||
row_data = tuple([form.cleaned_data[field] for field in unique_check if field in form.cleaned_data])
|
||||
if row_data and not None in row_data:
|
||||
# if we've aready seen it then we have a uniqueness failure
|
||||
if row_data in seen_data:
|
||||
# poke error messages into the right places and mark
|
||||
|
||||
Reference in New Issue
Block a user