English 中文(简体)
App Engine: Filter for Choosing Entities with a Specific Item Present in their ListProperties
原标题:

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?

最佳回答

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.

问题回答

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".





相关问题
How to make logging.debug work on Appengine?

I m having a tough time getting the logging on Appengine working. the statement import logging is flagged as an unrecognized import in my PyDev Appengine project. I suspected that this was just an ...

gqlQuery returns object, want list of keys

Is there a way to convert the GqlQuery object to an array of keys, or is there a way to force the query to return an array of keys? For example: items = db.GqlQuery("SELECT __key__ FROM Items") ...

Integrating Google AppEngine with a Thick Client

I want to make a multi-user client-server solution with Java Swing thick client as a front-end and Google AppEngine (Java one) as a back-end. The problem is that GAE provides only web-based forms for ...

sorl.thumbnail : thumbnail is not a valid tag library?

I am trying to install sorl.thumbnail but am getting the following error message: thumbnail is not a valid tag library: Could not load template library from django.templatetags.thumbnail, No module ...

热门标签