Closed michaelgodshall closed 7 years ago
I'm trying to use the is_
operator, but passing different values like 'None'
or false
doesn't work.
I released a new version 0.12.5 so now you can try this:
First you can try this:
?filter=[{"name":"relation","op":"eq","val":null}]
it means: filter(Model.relation == None)
If it doesn't work you can try this:
?filter=[{
"not": {
"name":"relation",
"op":"any",
"val": null
}
}]
this means with sqlalchemy : filter(~Model.relation.any(None))
and in SQL:
SELECT * FROM Model
WHERE NOT (EXISTS (SELECT 1
FROM RelatedModel
WHERE Model.foreign_key = RelatedModel.foreign_key))
Has the fix occurred only on this operator?
I have the same problem in the filter:
{"name":"category_id","op":"in","val":[1,null]}
How can I filter a relationship using a null value? Flask-Restless uses
is_null
oris_not_null
, but there doesn't seem to be a similar operator in Flask-Rest-JSONAPI. Any recommendations on how to achieve the same result in Flask-Rest-JSONAPI?