mirror of
https://github.com/netbox-community/netbox.git
synced 2025-12-10 18:39:36 -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
fd9a6b958b
commit
4ca4983204
@ -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