我在石墨烯突变中有一个graphene.DateTime()
字段作为参数。我可以按照如下文档中所述在此字段上设置过滤器:
class TaskNode(DjangoObjectType):
class Meta:
model = Task
filter_fields = {
"due_date": ["lte", "gte", "exact"],
}
interfaces = (relay.Node,)
这些过滤器可以正常工作。但是,我希望能够过滤due_date
的值为null
的那些对象。但是,当我将isnull
添加到过滤器时,会得到以下内容。
查询:
query {
allEvents(endDate_Isnull: true) {
edges {
node {
id
}
}
}
}
输出:
"message": "Argument \"endDate_Isnull\" has invalid value true.
Expected type \"DateTime\", found true.",
显然,即使使用isnull
过滤器,我也只能输入DateTime
类型的参数值。在石墨烯中实现此过滤器的正确方法是什么?
答案 0 :(得分:0)
您的代码看起来不错,但是我想您遇到了以下错误:https://github.com/graphql-python/graphene-django/issues/750