这是按主题ID过滤的。 Graphql不会出错,但是不会按topic_id进行过滤:
Handler
但是当我按主题名称过滤时:
ORDER BY tt.tstatus
与名称完美配合。但是,我需要按ID进行过滤。
Graphql查询:
class ArticleNode(DjangoObjectType):
class Meta:
model = Article
filter_fields = ['topic__id']
interfaces = (relay.Node, )
oid = graphene.Field(graphene.Int)
def resolve_oid(self, info, **kwargs):
return self.id
不会出错但无法正常运行的GraphQl查询:
class ArticleNode(DjangoObjectType):
class Meta:
model = Article
filter_fields = ['topic__name']
interfaces = (relay.Node, )
oid = graphene.Field(graphene.Int)
def resolve_oid(self, info, **kwargs):
return self.id