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 |
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 PeopleAttribute: | |
# Generic class for description | |
name = graphene.String(description="Name of the person.") | |
height = graphene.String(description="Height of the person.") | |
mass = graphene.String(description="Mass of the person.") | |
hair_color = graphene.String(description="Hair color of the person.") | |
skin_color = graphene.String(description="Skin color of the person.") | |
eye_color = graphene.String(description="Eye color of the person.") | |
birth_year = graphene.String(description="Birth year of the person.") | |
gender = graphene.String(description="Gender of the person.") |
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 PeopleModel(Base): | |
# People model | |
__tablename__ = 'people' | |
id = Column('id', Integer, primary_key=True, doc="Id of the person.") | |
name = Column('name', String, doc="Name of the person.") | |
height = Column('height', String, doc="Height of the person.") | |
mass = Column('mass', String, doc="Mass of the person.") | |
hair_color = Column('hair_color', String, doc="Hair color of the person.") |