Take the 2-minute tour ×

Having these models on google app engine:

class Choice(db.Model):
    poll = db.ReferenceProperty(Poll, collection_name = 'choices' )
    text = db.StringProperty()

class Vote(db.Model):
    choice = db.ReferenceProperty(Choice, collection_name = 'votes' )
    ip = db.StringProperty()
    date = db.DateTimeProperty(auto_now=1)

How do I do this django query?

same_vote = Vote.filter(ip=self.ip, choice__poll=self.choice.poll)
share|improve this question

1 Answer 1

up vote 3 down vote accepted

The App Engine datastore isn't capable of doing a query like this, which requires a join. To perform such a query, you'll need to denormalize your data so your Vote entities include information about which Poll they apply to.

share|improve this answer

Your Answer


