Skip to content

Conversation

@jeremystretch
Copy link
Member

Closes: #6615

  • Refactors BaseFilterSet
  • Ditches CustomFieldFilter in favor of stock filter intstances
  • Add to_filter() method on CustomField model
  • Moves MACAddressField form field to utilities (to resolve a circular import)
  • Enables multi-value filters for custom fields

@jeremystretch
Copy link
Member Author

I think this is mostly done, just need to fix a bug with integer handling and extend the test suite for custom field filters to test the lookups and multiple values.

@jeremystretch
Copy link
Member Author

I think I've got this wrapped up, with just one issue: It seems that MultiValueNumberFilter isn't properly casting query parameters to integer values. This hasn't been a problem so far, because Django is smart enough to know that "10" means 10 when querying an integer field. However, custom field data is stored as JSON, so we need to be explicit about the type.

Here's what what the underlying SQL ends up as:

SELECT ••• FROM "dcim_site" WHERE ("dcim_site"."custom_field_data" -> 'foo') = '"10"'

As this is out of scope for this FR, I'm going to leave it be for the moment, and will file a new bug report.

@jeremystretch jeremystretch marked this pull request as ready for review October 29, 2021 15:02
@jeremystretch jeremystretch merged commit f420435 into feature Oct 29, 2021
@jeremystretch jeremystretch deleted the 6615-custom-field-filters branch October 29, 2021 15:21
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 21, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants