Fixes #8314: Prevent custom fields with default values from appearing as applied filters erroneously

This commit is contained in:
jeremystretch
2022-01-11 15:02:10 -05:00
parent 5713076155
commit 03bbc410ad
3 changed files with 3 additions and 2 deletions

View File

@@ -121,5 +121,5 @@ class CustomFieldModelFilterForm(FilterForm):
)
for cf in custom_fields:
field_name = f'cf_{cf.name}'
self.fields[field_name] = cf.to_form_field(set_initial=True, enforce_required=False)
self.fields[field_name] = cf.to_form_field(set_initial=False, enforce_required=False)
self.custom_field_filters.append(field_name)

View File

@@ -239,7 +239,7 @@ class CustomField(ChangeLoggedModel):
"""
Return a form field suitable for setting a CustomField's value for an object.
set_initial: Set initial date for the field. This should be False when generating a field for bulk editing.
set_initial: Set initial data for the field. This should be False when generating a field for bulk editing.
enforce_required: Honor the value of CustomField.required. Set to False for filtering/bulk editing.
for_csv_import: Return a form field suitable for bulk import of objects in CSV format.
"""