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

Fix: Field with the same name as a lookup in FILTER_EXPRESSION_TOKENS causes crash when filtering with implicit exact #184

Conversation

ababic
Copy link
Contributor

@ababic ababic commented Feb 3, 2024

Alternative to #172, which fixes #171 in a slightly different way.

Using get_model_field() here means the issue shouldn't surface when filtering on related fields either, which is the case I stumbled into recently on a client project.

I've also fixed an issue with extract_field_value() here, where it chokes when encountering a null FK value while traversing to a related field (get_model_field() supports this kind of traversal, so we should really be handling that)

@ababic ababic force-pushed the fix/171-field-names-swallowed-when-match-an-expression branch 9 times, most recently from 18568cc to 8dc234b Compare February 4, 2024 08:35
@ababic ababic changed the title Fix: Field with the same name as a lookup in FILTER_EXPRESSION_TOKENS causes crash when filtering Fix: Field with the same name as a lookup in FILTER_EXPRESSION_TOKENS causes crash when filtering with implicit exact Feb 4, 2024
@ababic ababic force-pushed the fix/171-field-names-swallowed-when-match-an-expression branch 3 times, most recently from ba4b189 to 04e435d Compare February 4, 2024 10:31
@ababic ababic force-pushed the fix/171-field-names-swallowed-when-match-an-expression branch from 04e435d to bc3e01a Compare February 4, 2024 21:10
@ababic
Copy link
Contributor Author

ababic commented Feb 9, 2024

@gasman Any chance of a review on this one? I have plans to fix some additional issues with __date, __time (etc) usage in values() and values_list(), but am reticent to create rebasing work for myself.

@ababic ababic force-pushed the fix/171-field-names-swallowed-when-match-an-expression branch from bc3e01a to 9cb175d Compare February 17, 2024 11:37
Copy link
Contributor

@gasman gasman left a comment

Choose a reason for hiding this comment

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

Thanks @ababic - happy with this!

@gasman gasman merged commit 281e64a into wagtail:main Feb 21, 2024
5 checks passed
gasman added a commit that referenced this pull request Feb 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants