Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes: #17663 - Only remove extraneous attributes from extra if changing to a BooleanFilter #17670

Merged
merged 7 commits into from
Oct 3, 2024

Conversation

bctiemann
Copy link
Contributor

@bctiemann bctiemann commented Oct 3, 2024

Fixes: #17663

Refines #17574 to ensure we only remove choices from the filter's extra attributes if we are artificially changing it to a BooleanFilter (i.e. if the lookup is __empty). This fixes an issue where choices was not being respected in the case of MultipleChoiceField where it should be allowed.

Also adds a test to ensure MultipleChoiceField character-based lookups are exercised.
Also adds tests for __empty lookup to the base filter lookup tests to exercise that behavior generically.

@bctiemann bctiemann self-assigned this Oct 3, 2024
Copy link
Member

@jeremystretch jeremystretch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @bctiemann!

@jeremystretch jeremystretch merged commit ce04ec2 into develop Oct 3, 2024
6 checks passed
@jeremystretch jeremystretch deleted the 17663-fix-multiple-choice-filters branch October 3, 2024 17:50
bctiemann added a commit that referenced this pull request Oct 11, 2024
…ing to a BooleanFilter (#17670)

* Only remove extraneous attributes from extra if changing to a BooleanField

* Add tests for MultipleChoiceField icontains and negation

* Use enum in test consistently

* Reorganize tests

* Add __empty test to base filter lookup tests

* Fix test name

* Change var name for clarity
jeremystretch pushed a commit to alehaa/netbox that referenced this pull request Oct 11, 2024
…m extra if changing to a BooleanFilter (netbox-community#17670)

* Only remove extraneous attributes from extra if changing to a BooleanField

* Add tests for MultipleChoiceField icontains and negation

* Use enum in test consistently

* Reorganize tests

* Add __empty test to base filter lookup tests

* Fix test name

* Change var name for clarity
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 3, 2024
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.

Type interface filter not working since 4.1.2
2 participants