mirror of
https://github.com/netbox-community/netbox.git
synced 2025-12-16 13:29:37 -06:00
Add ChoiceField support to FilterModifierMixin
Enable filter modifiers for single-choice ChoiceFields in addition to the existing MultipleChoiceField support. ChoiceFields can now display modifier dropdowns with "Is", "Is Not", "Is Empty", and "Is Not Empty" options when the corresponding FilterSet defines those lookups. The mixin correctly verifies lookup availability against the FilterSet, so modifiers only appear when multiple lookup options are actually supported. Currently most FilterSets only define 'exact' for single-choice fields, but this change enables future FilterSet enhancements to expose additional lookups for ChoiceFields.
This commit is contained in:
parent
e9bacf9a2e
commit
de96bc8770
@ -151,6 +151,12 @@ class FilterModifierMixin:
|
||||
(MODIFIER_EMPTY_TRUE, _('Is Empty')),
|
||||
(MODIFIER_EMPTY_FALSE, _('Is Not Empty')),
|
||||
],
|
||||
forms.ChoiceField: [
|
||||
('exact', _('Is')),
|
||||
('n', _('Is Not')),
|
||||
(MODIFIER_EMPTY_TRUE, _('Is Empty')),
|
||||
(MODIFIER_EMPTY_FALSE, _('Is Not Empty')),
|
||||
],
|
||||
forms.MultipleChoiceField: [
|
||||
('exact', _('Is')),
|
||||
('n', _('Is Not')),
|
||||
|
||||
Loading…
Reference in New Issue
Block a user