Skip to content

Instantly share code, notes, and snippets.

View bertavincze's full-sized avatar

Berta Vincze bertavincze

View GitHub Profile
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
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.")
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.")