Fixes #7321: Don't overwrite multi-select custom fields during bulk edit

This commit is contained in:
jeremystretch
2021-09-21 13:41:33 -04:00
parent 6fcd47abe2
commit c8fbf348ea
2 changed files with 3 additions and 2 deletions

View File

@@ -824,14 +824,14 @@ class BulkEditView(GetReturnURLMixin, ObjectPermissionRequiredMixin, View):
if form.cleaned_data[name]:
getattr(obj, name).set(form.cleaned_data[name])
# Normal fields
elif form.cleaned_data[name] not in (None, '', []):
elif name in form.changed_data:
setattr(obj, name, form.cleaned_data[name])
# Update custom fields
for name in custom_fields:
if name in form.nullable_fields and name in nullified_fields:
obj.custom_field_data[name] = None
elif form.cleaned_data.get(name) not in (None, ''):
elif name in form.changed_data:
obj.custom_field_data[name] = form.cleaned_data[name]
obj.full_clean()