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

Add support for filterset_class meta parameter #600

Merged
merged 4 commits into from Jun 9, 2019
Merged

Add support for filterset_class meta parameter #600

merged 4 commits into from Jun 9, 2019

Conversation

ghost
Copy link

@ghost ghost commented Mar 25, 2019

This would enable filtering on Django relationships that create a default DjangoFilterConnectionField based on the model type and its meta parameters.

  • Allow for use of either filter_fields or filterset_class
  • Add tests to check that the behavior is similar to filter_fields
  • Add documentation to show how to make use of the parameter

* Allow for use of either filter_fields or filterset_class
* Add tests to check that the behavior is similar to filter_fields
* Add documentation to show how to make use of the parameter
@coveralls
Copy link

coveralls commented Mar 25, 2019

Coverage Status

Coverage increased (+0.02%) to 94.381% when pulling d2f8bf7 on sierreis:filterset-class into ea2cd98 on graphql-python:master.

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.06%) to 94.298% when pulling 5c191b9 on sierreis:filterset-class into ea2cd98 on graphql-python:master.

@zbyte64
Copy link
Collaborator

zbyte64 commented Mar 25, 2019

Is there a particular reason why we don't pass the provided filterset class through get_filterset_class / setup_filterset which injects GrapheneFilterSetMixin ?

@ghost
Copy link
Author

ghost commented Mar 26, 2019

Nope, I just pushed a fix for that part so that it has the same behavior as passing in the FilterSet as an argument to DjangoFilterConnectionField. I think there's some important overriding behavior in the mixin to work with Relay node IDs rather than the database ID.

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.

This seems reasonable to me.

@zbyte64
Copy link
Collaborator

zbyte64 commented Mar 27, 2019

Test coverage decreased because a new scenario is not tested:

  • Failure when both filter_fields & filter_class are defined

@ghost
Copy link
Author

ghost commented Mar 31, 2019

@mvanlonden, the latest commit should have the previously requested test case (when filter_fields and filterset_class are both set), and the coverage is now up 0.2%. Let me know if you had something else in mind.

@mvanlonden mvanlonden merged commit a9a8d67 into graphql-python:master Jun 9, 2019
@jkimbo jkimbo mentioned this pull request Jul 9, 2019
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

4 participants