File tree Expand file tree Collapse file tree 1 file changed +13
-1
lines changed Expand file tree Collapse file tree 1 file changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -17,9 +17,21 @@ def model_fields_as_dict(model):
17
17
return dict ((f .name , f ) for f in model ._meta .get_fields ())
18
18
19
19
20
+ def find_model_selections (ast ):
21
+ selections = ast .selection_set .selections
22
+
23
+ for selection in selections :
24
+ if selection .name .value == 'edges' :
25
+ for sub_selection in selection .selection_set .selections :
26
+ if sub_selection .name .value == 'node' :
27
+ return sub_selection .selection_set .selections
28
+
29
+ return selections
30
+
31
+
20
32
def get_related_fetches_for_model (model , graphql_ast ):
21
33
model_fields = model_fields_as_dict (model )
22
- selections = graphql_ast . selection_set . selections
34
+ selections = find_model_selections ( graphql_ast )
23
35
24
36
graphene_obj_type = REGISTRY .get_type_for_model (model )
25
37
optimizations = {}
You can’t perform that action at this time.
0 commit comments