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 crash when filtering on implicit pk field on abstract model #1328

Merged
merged 2 commits into from
Jan 23, 2023

Conversation

flaeppe
Copy link
Member

@flaeppe flaeppe commented Jan 22, 2023

I have made things!

Avoid crashing when queryset filters on an implicit pk field for a model, when model is abstract.

I tried to figure out #1261 and while type checking Django's test suite I came across the same error as in #1189. But reproduced when filtering on django.contrib.auth.models.AbstractUser.

Related issues

Closes #1189

I wasn't able to reproduce with the example found in the linked issue though.

@flaeppe flaeppe changed the title Don't crash when filtering on implicit field on abstract model Don't crash when filtering on implicit pk field on abstract model Jan 22, 2023
@flaeppe flaeppe requested a review from intgr January 23, 2023 15:42
@intgr intgr changed the title Don't crash when filtering on implicit pk field on abstract model Fix crash when filtering on implicit pk field on abstract model Jan 23, 2023
Copy link
Collaborator

@intgr intgr left a comment

Choose a reason for hiding this comment

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

Looks good to me, waiting for CI.

@intgr intgr merged commit d716b49 into typeddjango:master Jan 23, 2023
@flaeppe flaeppe deleted the fix/abstract-model-filtering branch January 24, 2023 21:31
@simonpercivall
Copy link

Actually, #1189 wasn't closed by this. My example was faulty, it was a .values_list("pk") that causes the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

Plugin crash on abstract model filtering with custom Manager
3 participants