Skip to content

Commit d2968c9

Browse files
committed
Fixes #8314: Prevent custom fields with default values from appearing as applied filters erroneously
1 parent 7421e5f commit d2968c9

File tree

3 files changed

+3
-2
lines changed

3 files changed

+3
-2
lines changed

docs/release-notes/version-3.1.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
* [#8301](https://github.com/netbox-community/netbox/issues/8301) - Fix delete button for various object children views
1717
* [#8305](https://github.com/netbox-community/netbox/issues/8305) - Fix assignment of custom field data to FHRP groups via UI
1818
* [#8306](https://github.com/netbox-community/netbox/issues/8306) - Redirect user to previous page after login
19+
* [#8314](https://github.com/netbox-community/netbox/issues/8314) - Prevent custom fields with default values from appearing as applied filters erroneously
1920
* [#8317](https://github.com/netbox-community/netbox/issues/8317) - Fix CSV import of multi-select custom field values
2021

2122
---

netbox/extras/forms/customfields.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,5 +121,5 @@ def __init__(self, *args, **kwargs):
121121
)
122122
for cf in custom_fields:
123123
field_name = f'cf_{cf.name}'
124-
self.fields[field_name] = cf.to_form_field(set_initial=True, enforce_required=False)
124+
self.fields[field_name] = cf.to_form_field(set_initial=False, enforce_required=False)
125125
self.custom_field_filters.append(field_name)

netbox/extras/models/customfields.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,7 @@ def to_form_field(self, set_initial=True, enforce_required=True, for_csv_import=
239239
"""
240240
Return a form field suitable for setting a CustomField's value for an object.
241241
242-
set_initial: Set initial date for the field. This should be False when generating a field for bulk editing.
242+
set_initial: Set initial data for the field. This should be False when generating a field for bulk editing.
243243
enforce_required: Honor the value of CustomField.required. Set to False for filtering/bulk editing.
244244
for_csv_import: Return a form field suitable for bulk import of objects in CSV format.
245245
"""

0 commit comments

Comments
 (0)