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

Check model fields on filtering methods of queryset types #2277

Merged
merged 1 commit into from
Jul 26, 2024

Conversation

flaeppe
Copy link
Member

@flaeppe flaeppe commented Jul 25, 2024

I noticed that we should check some methods on both Manager and QuerySet since the Manager class is a bit special as it is a type "merged" from BaseManager and QuerySet.

@sobolevn I think this could be a nice addition before releasing 5.0.3, or what do you think?

Thinking that the use cases from the test included here aren't too foreign:

MyModel.objects.filter(id=1).filter(invalid=1)
MyModel.objects.filter(id=1).get(invalid=1)
MyModel.objects.filter(id=1).exclude(invalid=1)
MyModel.objects.filter(id=1).create(invalid=1)

Copy link
Member

@sobolevn sobolevn left a comment

Choose a reason for hiding this comment

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

Thanks, very good usecase.

@flaeppe flaeppe merged commit a28717d into typeddjango:master Jul 26, 2024
36 checks passed
@flaeppe flaeppe deleted the fix/check-filtering-methods branch July 28, 2024 07:18
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.

2 participants