Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Filter objects with select/multiselect custom fields by choice PK #5552

Merged
merged 5 commits into from
Apr 10, 2024

Conversation

glennmatthews
Copy link
Contributor

@glennmatthews glennmatthews commented Apr 9, 2024

Closes #5009

What's Changed

Added the option to filter objects with select/multi-select custom fields based on the UUID of the defined custom field choice(s), for example /api/dcim/locations/?cf_multiselect=1ea9237c-3ba7-4985-ba7e-6fd9e9bff813 as an alternative to /api/dcim/locations/?cf_multiselect=some-choice-value.

  • Added CustomFieldSelectFilter class with custom get_filter_predicate() implementation
  • Changed CustomFieldMultiSelectFilter to be a subclass of CustomFieldSelectFilter
  • Removed CustomFieldMultiValueSelectFilter as it's confusing, totally unused, and not part of the apps namespace.
  • Changed extended filter for multi-select custom fields from __n to __nic to match the fact that the base filter here is icontains, not exact. (I'm second-guessing this now, but it "feels" like a bug fix - thoughts??) reverted this out of caution
  • Add unit tests covering the new functionality.

Screenshots

image image

TODO

  • Explanation of Change(s)
  • Added change log fragment(s) (for more information see the documentation)
  • Attached Screenshots, Payload Example
  • Unit, Integration Tests
  • Documentation Updates (when adding/changing features)
  • n/a Example App Updates (when adding/changing features)
  • Outline Remaining Work, Constraints from Design

@glennmatthews glennmatthews merged commit 60bb72e into develop Apr 10, 2024
17 checks passed
@glennmatthews glennmatthews deleted the u/glennmatthews-5009-cf-filter-by-choice-id branch April 10, 2024 19:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Custom Field filter doesn't work if UUID is provided
2 participants