Multi-value filters should run validate() on each value #7057

Closed
opened 2025-12-29 19:48:27 +01:00 by adam · 0 comments
Owner

Originally created by @jeremystretch on GitHub (Sep 30, 2022).

Originally assigned to: @jeremystretch on GitHub.

Proposed Changes

We use multivalue_field_factory() to generate filters that accept multiple values, to support querying for e.g. ?status=a&status=b (applying an OR logic). However, these filters are not properly validating the passed values. The class returned by multivalue_field_factory() should have its run_validators() and validate() methods overriden so that they execute on each value in the list.

Justification

This problem was originally uncovered by @arthanson while working on #10348. I've broken it into a separate issue for explicit tracking of the change, as it affects all multi-value filters.

Originally created by @jeremystretch on GitHub (Sep 30, 2022). Originally assigned to: @jeremystretch on GitHub. ### Proposed Changes We use [`multivalue_field_factory()`]() to generate filters that accept multiple values, to support querying for e.g. `?status=a&status=b` (applying an OR logic). However, these filters are not properly validating the passed values. The class returned by `multivalue_field_factory()` should have its `run_validators()` and `validate()` methods overriden so that they execute on each value in the list. ### Justification This problem was originally uncovered by @arthanson while working on #10348. I've broken it into a separate issue for explicit tracking of the change, as it affects all multi-value filters.
adam added the status: acceptedtype: housekeeping labels 2025-12-29 19:48:27 +01:00
adam closed this issue 2025-12-29 19:48:27 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#7057