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
Select by foreign key doesn't works as expected #2304
Comments
Thanks for the succinct issue report. For now I've made a provisional fix which correctly delegates to the |
…odels. When a model instance is passed as a parameter on the right-hand-side of an expression, Peewee would previously just grab the model's primary-key value. This breaks queries where the left-hand-side is a foreign-key that points to a field other than the primary-key. To address this I've added a test to try and use the converter in the scope (if available), and fall back to using the model pk. Fixes #2304
Many thanks. |
layout is affected by coleifer/peewee#2304
Hello. We have the foreign keys with related field that is not equal the primary key to the related model.
The following code snippet shows an invalid SELECT query when we use in the select query related model object instead of just identifier.
Output:
Thanks
The text was updated successfully, but these errors were encountered: