MCPcopy Create free account
hub / github.com/graphql-python/graphene-django / get_model_fields

Function get_model_fields

graphene_django/utils/utils.py:95–106  ·  view source on GitHub ↗

Gets all the fields and relationships on the Django model and its ancestry. Prioritizes local fields and relationships over the reverse relationships of the same name Returns a tuple of (field.name, field)

(model)

Source from the content-addressed store, hash-verified

93
94
95def get_model_fields(model):
96 """
97 Gets all the fields and relationships on the Django model and its ancestry.
98 Prioritizes local fields and relationships over the reverse relationships of the same name
99 Returns a tuple of (field.name, field)
100 """
101 local_fields = get_local_fields(model)
102 local_field_names = {field[0] for field in local_fields}
103 reverse_fields = get_reverse_fields(model, local_field_names)
104 all_fields = local_fields + list(reverse_fields)
105
106 return all_fields
107
108
109def is_valid_django_model(model):

Callers 2

construct_fieldsFunction · 0.85

Calls 2

get_local_fieldsFunction · 0.85
get_reverse_fieldsFunction · 0.85

Tested by 1

Used in the wild real call sites across dependent graphs

searching dependent graphs…