开发者

How to find entries which has not empty StringListProperty?

开发者 https://www.devze.com 2023-03-02 08:01 出处:网络
I have a following model in the Google appengine app. class TestModel(db.Model): names = db.StringListProperty(required=False)

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

精彩评论

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

关注公众号