如何@property
从 django 模型 graphql 结果中添加字段?:
class MyModel(...):
...
@property
def some_property(self):
return 'property here'
class MyObject(DjangoObjectType):
class Meta:
model = MyModel
interfaces = (relay.Node,)
filter_fields = []
query GetMyModel(id: ID!){
getMyModel(id: $id){
someProperty
}
}