How to use graphene-django - 10 common examples

To help you get started, we’ve selected a few graphene-django examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github graphql-python / graphene / graphene-django / examples / starwars / data.py View on Github external
def create_ship(ship_name, faction_id):
    new_ship = Ship(
        name=ship_name,
        faction_id=faction_id
    )
    new_ship.save()
    return new_ship
github graphql-python / graphene / graphene-django / examples / starwars / data.py View on Github external
empire = Faction(
        id='2',
        name='Galactic Empire',
        hero=droid
    )
    empire.save()

    xwing = Ship(
        id='1',
        name='X-Wing',
        faction=rebels,
    )
    xwing.save()

    ywing = Ship(
        id='2',
        name='Y-Wing',
        faction=rebels,
    )
    ywing.save()

    awing = Ship(
        id='3',
        name='A-Wing',
        faction=rebels,
    )
    awing.save()

    # Yeah, technically it's Corellian. But it flew in the service of the rebels,
    # so for the purposes of this demo it's a rebel ship.
    falcon = Ship(
github graphql-python / graphene / graphene-django / examples / starwars / data.py View on Github external
tieFighter = Ship(
        id='6',
        name='TIE Fighter',
        faction=empire,
    )
    tieFighter.save()

    tieInterceptor = Ship(
        id='7',
        name='TIE Interceptor',
        faction=empire,
    )
    tieInterceptor.save()

    executor = Ship(
        id='8',
        name='Executor',
        faction=empire,
    )
    executor.save()
github graphql-python / graphene / graphene-django / examples / starwars / data.py View on Github external
id='3',
        name='A-Wing',
        faction=rebels,
    )
    awing.save()

    # Yeah, technically it's Corellian. But it flew in the service of the rebels,
    # so for the purposes of this demo it's a rebel ship.
    falcon = Ship(
        id='4',
        name='Millenium Falcon',
        faction=rebels,
    )
    falcon.save()

    homeOne = Ship(
        id='5',
        name='Home One',
        faction=rebels,
    )
    homeOne.save()

    tieFighter = Ship(
        id='6',
        name='TIE Fighter',
        faction=empire,
    )
    tieFighter.save()

    tieInterceptor = Ship(
        id='7',
        name='TIE Interceptor',
github graphql-python / graphene / graphene-django / examples / starwars / data.py View on Github external
homeOne = Ship(
        id='5',
        name='Home One',
        faction=rebels,
    )
    homeOne.save()

    tieFighter = Ship(
        id='6',
        name='TIE Fighter',
        faction=empire,
    )
    tieFighter.save()

    tieInterceptor = Ship(
        id='7',
        name='TIE Interceptor',
        faction=empire,
    )
    tieInterceptor.save()

    executor = Ship(
        id='8',
        name='Executor',
        faction=empire,
    )
    executor.save()
github graphql-python / graphene / graphene-django / examples / starwars / data.py View on Github external
xwing = Ship(
        id='1',
        name='X-Wing',
        faction=rebels,
    )
    xwing.save()

    ywing = Ship(
        id='2',
        name='Y-Wing',
        faction=rebels,
    )
    ywing.save()

    awing = Ship(
        id='3',
        name='A-Wing',
        faction=rebels,
    )
    awing.save()

    # Yeah, technically it's Corellian. But it flew in the service of the rebels,
    # so for the purposes of this demo it's a rebel ship.
    falcon = Ship(
        id='4',
        name='Millenium Falcon',
        faction=rebels,
    )
    falcon.save()

    homeOne = Ship(
github graphql-python / graphene / graphene-django / examples / starwars / data.py View on Github external
rebels = Faction(
        id='1',
        name='Alliance to Restore the Republic',
        hero=human
    )
    rebels.save()

    empire = Faction(
        id='2',
        name='Galactic Empire',
        hero=droid
    )
    empire.save()

    xwing = Ship(
        id='1',
        name='X-Wing',
        faction=rebels,
    )
    xwing.save()

    ywing = Ship(
        id='2',
        name='Y-Wing',
        faction=rebels,
    )
    ywing.save()

    awing = Ship(
        id='3',
        name='A-Wing',
github graphql-python / graphene / graphene-django / examples / starwars / data.py View on Github external
id='2',
        name='Y-Wing',
        faction=rebels,
    )
    ywing.save()

    awing = Ship(
        id='3',
        name='A-Wing',
        faction=rebels,
    )
    awing.save()

    # Yeah, technically it's Corellian. But it flew in the service of the rebels,
    # so for the purposes of this demo it's a rebel ship.
    falcon = Ship(
        id='4',
        name='Millenium Falcon',
        faction=rebels,
    )
    falcon.save()

    homeOne = Ship(
        id='5',
        name='Home One',
        faction=rebels,
    )
    homeOne.save()

    tieFighter = Ship(
        id='6',
        name='TIE Fighter',
github graphql-python / graphene / graphene-django / examples / starwars / data.py View on Github external
# so for the purposes of this demo it's a rebel ship.
    falcon = Ship(
        id='4',
        name='Millenium Falcon',
        faction=rebels,
    )
    falcon.save()

    homeOne = Ship(
        id='5',
        name='Home One',
        faction=rebels,
    )
    homeOne.save()

    tieFighter = Ship(
        id='6',
        name='TIE Fighter',
        faction=empire,
    )
    tieFighter.save()

    tieInterceptor = Ship(
        id='7',
        name='TIE Interceptor',
        faction=empire,
    )
    tieInterceptor.save()

    executor = Ship(
        id='8',
        name='Executor',