Rework 'lookup types' handling into LookupChoiceFilter #851
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Remove "lookup types" handling for
Filter.lookup_expr
, where alist
orNone
value would trigger the use ofLookupTypeField
. This has been replaced with a dedicatedLookupChoiceFilter
.I decided to replace the feature outright and raise an assertion with the relevant removal message, instead of attempting to go through a deprecation path. While it should be possible, it didn't seem worth the effort to try support/deprecate the old functionality, especially given the clean break 2.0 provides.
Should also fix #843 (at least the reliance on the defunct
QUERY_TERMS
).Changes:
LookupChoiceFilter
list
andNone
value handling forlookup_expr
. Using this form will fail an assertion check.LOOKUP_TYPES
module variable fromdjango_filters.filters
.LookupTypeWidget
toLookupChoiceWidget
.LookupTypeField
toLookupChoiceField
.Lookup.lookup_type
toLookup.lookup_expr
.Lookup
to only accept non-empty values. If aLookup
is missing a value, aNone
should be provided instead.