mirror of
https://github.com/netbox-community/netbox.git
synced 2025-08-02 05:46:25 -06:00
Only remove extraneous attributes from extra if changing to a BooleanField
This commit is contained in:
parent
6ea0c0c3e9
commit
6df76ae870
@ -180,9 +180,11 @@ class BaseFilterSet(django_filters.FilterSet):
|
||||
# create the new filter with the same type because there is no guarantee the defined type
|
||||
# is the same as the default type for the field
|
||||
resolve_field(field, lookup_expr) # Will raise FieldLookupError if the lookup is invalid
|
||||
for field_to_remove in ('choices', 'null_value'):
|
||||
existing_filter_extra.pop(field_to_remove, None)
|
||||
filter_cls = django_filters.BooleanFilter if lookup_expr == 'empty' else type(existing_filter)
|
||||
filter_cls = type(existing_filter)
|
||||
if lookup_expr == 'empty':
|
||||
filter_cls = django_filters.BooleanFilter
|
||||
for field_to_remove in ('choices', 'null_value'):
|
||||
existing_filter_extra.pop(field_to_remove, None)
|
||||
new_filter = filter_cls(
|
||||
field_name=field_name,
|
||||
lookup_expr=lookup_expr,
|
||||
|
Loading…
Reference in New Issue
Block a user