Just noticed there is a small typo in the code above, the query should be hitting "WaitingQuestions", not "WaitingAnswer".
On Dec 15, 11:00 am, Lenny Rachitsky <lenny...@gmail.com> wrote: > Does App Engine allow self-referencing queries, where I use a property > of an entity as part of the filter? For example, below I am attempting > to use the "question_ttl" property to filter questions that are > expired (e.g. older than "question_ttl" minutes). I'm attempting to > avoid having to iterate through the entire batch. Is this possible? I > attempted to use "self" below, but that doesn't work. > > -------------------- > class WaitingQuestions(db.Model): > question = db.TextProperty() > question_ttl = db.IntegerProperty() > timestamp = db.DateTimeProperty(auto_now=True, auto_now_add=True) > > @staticmethod > def get_expired_questions(): > return WaitingAnswer.all().filter('timestamp < ', > datetime.now() - timedelta(minutes=self.question_ttl)) > -------------------- > > Any help would be much appreciated. Thank you in advance, > Lenny -- You received this message because you are subscribed to the Google Groups "Google App Engine" group. To post to this group, send email to google-appeng...@googlegroups.com. To unsubscribe from this group, send email to google-appengine+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-appengine?hl=en.