'How to use the result of a graphene resolved field in another field
I have this use case:
class ProjectType(graphene.objectType):
tasks = graphene.List(TaskType)
duration = graphene.Int() # days
def resolve_tasks():
return self.tasks.all()
def resolve_duration():
return get_duration_from_tasks(self.tasks.all())
A project can have many tasks, so self.tasks.all() can be an expensive db query to do twice.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
