Question

I need to filter entities based on one of their ListProperties having a certain element present. So kind of like:

entities.filter('listProp IN ',element) except where listProp and element are reversed if you see what I mean.

Anyone know how to filter like this?

Was it helpful?

Solution 2

Ok so it turns out the IN equality clause takes care of this case for lists automatically.

As in it does a for ... each on the list of elements to be searched for and if any one of them is present in the ListProperty for each entity it will return that entity.

OTHER TIPS

If I understand you correctly, you want to find all entities which have that particular element present. You should be able to use: entities.filter('listProp =', element)

Look at: http://code.google.com/appengine/docs/python/datastore/typesandpropertyclasses.html#ListProperty

It says, "list_property = value tests if the value appears anywhere in the list".

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top