-
Notifications
You must be signed in to change notification settings - Fork 766
how to rename relationship? #1485
-
by default graphene django would generate the name of the relationship, using this pattern, Set like userSet
is it possible to change this to just user
? or define it manually somehow?
Beta Was this translation helpful? Give feedback.
All reactions
I think your question related to models layer more than graphene django
you can set related_name for your fk fileds or m2m
Replies: 1 comment 2 replies
-
I think your question related to models layer more than graphene django
you can set related_name for your fk fileds or m2m
Beta Was this translation helpful? Give feedback.
All reactions
-
this will change the generated django model level, what I am asking is how to change specifically the auto generated graphql field by graphene. Using related name will unfortunately change the django model set name as well, is it possible to just specifically change the generated graphql field?
The only way I can think of is to manually create a graphql field in the model and create the resolve_*
but it seems to be too much boiler plate :/
Beta Was this translation helpful? Give feedback.
All reactions
-
Yes, you are correct that you'd need to do it more manually if not specifying a related name at the model level. There is no built-in functionality for changing the relation (or field) names at the schema level.
Beta Was this translation helpful? Give feedback.
All reactions
-
👍 1