Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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 !=', [])

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)
like image 828
Nyambaa Avatar asked Apr 30 '11 02:04

Nyambaa


1 Answers

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.

like image 62
Drew Sears Avatar answered Nov 07 '22 18:11

Drew Sears