How to use the graphene-django.graphene_django.utils.get_related_model function in graphene-django

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 / graphene_django / converter.py View on Github external
def convert_onetoone_field_to_djangomodel(field, registry=None):
    model = get_related_model(field)

    def dynamic_type():
        _type = registry.get_type_for_model(model)
        if not _type:
            return

        return Field(_type)

    return Dynamic(dynamic_type)
github graphql-python / graphene / graphene-django / graphene_django / converter.py View on Github external
def convert_field_to_djangomodel(field, registry=None):
    model = get_related_model(field)

    def dynamic_type():
        _type = registry.get_type_for_model(model)
        if not _type:
            return

        return Field(_type, description=field.help_text)

    return Dynamic(dynamic_type)
github graphql-python / graphene / graphene-django / graphene_django / converter.py View on Github external
def convert_field_to_list_or_connection(field, registry=None):
    model = get_related_model(field)

    def dynamic_type():
        _type = registry.get_type_for_model(model)
        if not _type:
            return

        if is_node(_type):
            return get_connection_field(_type)
        return Field(List(_type))

    return Dynamic(dynamic_type)