开发者

How to find entries which has not empty StringListProperty?

I have a following model in the Google appengine app.

class TestModel(db.Model):
  names = db.StringListProperty(required=False)

So, I want to get entries which has not empty in names property. I tried like this.

TestModel.all().filter('names !=', [开发者_JS百科])

But it raises the exception: BadValueError: Filtering on lists is not supported

How can I filter it? or Should I check one by one like following?

for entry in TestModel.all():
  if len(entry.names) > 0:
     result.append(entry)


Try this:

TestModel.all().filter('names >=', None)

This will give you every entity with at least one value set for names, i.e. every value in the index.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜