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

Documentation - Add example for reverse filtering #789

Open
chgad opened this issue Feb 1, 2022 · 0 comments
Open

Documentation - Add example for reverse filtering #789

chgad opened this issue Feb 1, 2022 · 0 comments

Comments

@chgad
Copy link

chgad commented Feb 1, 2022

I came across the case where I wanted to query all Tags which have a certain property set on the related model like:

>>>Tag.objects.filter(food__is_vegetarian=True)
[<Tag: salad>, <Tag: salad>, <Tag: fruit>, <Tag: fruit>]

which can be easily solved by the given example for the Food query here by adding the .distinct() call.

Once you think about it, it is obvious but maybe we can just add it to be more explicit on this regard.

@rtpg rtpg added the docs label Nov 14, 2022
@AmaMidzu AmaMidzu self-assigned this Jul 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants