feat: add contains() operation to QuerySet#2163
Open
seladb wants to merge 5 commits intotortoise:developfrom
Open
feat: add contains() operation to QuerySet#2163seladb wants to merge 5 commits intotortoise:developfrom
contains() operation to QuerySet#2163seladb wants to merge 5 commits intotortoise:developfrom
Conversation
contains() operation to QuerySetcontains() operation to QuerySet
Contributor
Author
|
@abondar MSSQL tests fail randomly, but shouldn't be related to the changes in this PR |
contains() operation to QuerySetcontains() operation to QuerySet
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add
QuerySet.contains()method for checking if object exists in querysetDescription
Added
QuerySet.contains()which checks if a specific model instance exists within a queryset. Implementation includes:QuerySet.contains(obj)method intortoise/queryset.pythat returns aContainsQueryobjectContainsQueryclass that extendsExistsQueryand adds filtering by the object's primary keyMotivation and Context
This feature enables checking if a specific model instance belongs to a filtered queryset, useful for membership checks without fetching the full object.
It's also in par with Django API.
How Has This Been Tested?
test_containsintests/test_queryset.pycovering all casesChecklist: