Created
April 17, 2020 14:58
-
-
Save bertavincze/ac626f6409f286e5876076c9f6da7810 to your computer and use it in GitHub Desktop.
This file contains 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
class PeopleFilter(FilterSet): | |
class Meta: | |
model = PeopleModel | |
fields = {'name': ['eq', 'ne', 'in', 'ilike'], | |
'planet_id': ['eq', 'ne', 'in', 'gt', 'lt', 'gte', 'lte']} | |
class PlanetsFilter(FilterSet): | |
class Meta: | |
model = PlanetModel | |
fields = {'id': [...], # shortcut! | |
'name': ['eq', 'ne', 'in', 'ilike']} | |
class MyFilterableConnectionField(FilterableConnectionField): | |
filters = {PeopleModel: PeopleFilter(), PlanetModel: PlanetsFilter()} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment