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

Support "contains" and "overlap" filtering (v2) #1100

Merged

Conversation

lucas-bremond
Copy link
Contributor

@lucas-bremond lucas-bremond commented Jan 18, 2021

This PR adds support for the contains and overlap filters of Django.

This is basically extending #1070 (written by @tcleonard).


Contains:

query {
  # Returns Events that have `music` AND `sport` tags.
  events(tags_Contains: ["music", "sport"]) {
    edges {
      node {
        name
        tags
      }
    }
  }
}

Overlap:

query {
  # Returns Events that have `music` OR `sport` tags.
  events(tags_Overlap: ["music", "sport"]) {
    edges {
      node {
        name
        tags
      }
    }
  }
}

Note: this also applies the project setup fix from #1087 to the v2 branch.

Copy link
Collaborator

@zbyte64 zbyte64 left a comment

Choose a reason for hiding this comment

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

Stellar work. Any chance you can create a v3 as well? If not that's cool too, I can take care of that if needed.

@lucas-bremond lucas-bremond changed the title Support "contains" and "overlap" filtering Support "contains" and "overlap" filtering (v2) Jan 18, 2021
@lucas-bremond
Copy link
Contributor Author

lucas-bremond commented Jan 18, 2021

Stellar work. Any chance you can create a v3 as well? If not that's cool too, I can take care of that if needed.

@zbyte64 Here you go! #1101

@zbyte64 zbyte64 merged commit e0a5d1c into graphql-python:v2 Jan 19, 2021
@lucas-bremond lucas-bremond deleted the users/lucas/contains-overlap-filtering branch January 19, 2021 06:58
@tcleonard
Copy link
Collaborator

There is actually an issue with this PR I think. I think it breaks the name_Contains kind of filter (normal contains Django filter on string fields).
I'm looking for a way to fix this... will submit a PR asap.

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

Successfully merging this pull request may close these issues.

3 participants