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 inList and nInList lookup in filters on enum #363

Conversation

cpontvieux-systra
Copy link
Contributor

Description

Enum used in filters are evaluated to their .value for doing Django queries.

Unfortunately if a FilterLookup is used and a list is used for a lookup, then this transformation is not done, resulting in non-working django filter.

Types of Changes

  • Core
  • Bugfix
  • New feature
  • Enhancement/optimization
  • Documentation

The correction is to check is the value is a non-empty list for at least one Enum and then create a new list with the .value of each enum.
I have added some unit tests.

Issues Fixed or Closed by This PR

Checklist

  • My code follows the code style of this project. (to my knowledge)
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document. (the file resides in docs but yes)
  • I have added tests to cover my changes.
  • I have tested the changes and verified that they work and don't break anything (as well as I can manage).

@bellini666 bellini666 enabled auto-merge (squash) September 15, 2023 15:05
Copy link
Member

@bellini666 bellini666 left a comment

Choose a reason for hiding this comment

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

Thank you! :)

@bellini666 bellini666 merged commit b0c5fda into strawberry-graphql:main Sep 15, 2023
36 checks passed
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.

None yet

2 participants