Skip to content

Instantly share code, notes, and snippets.

@topless
Last active October 19, 2016 13:24
Show Gist options
  • Save topless/10e2ad9d3eebc2760612 to your computer and use it in GitHub Desktop.
Save topless/10e2ad9d3eebc2760612 to your computer and use it in GitHub Desktop.
Query entities from a specific date and forth.
# https://github.com/gae-init/gae-init, for the rest of the functions
import datetime
def entities_from_date():
cursor = {'prev': None, 'next': None}
test_date = datetime.datetime.now() - datetime.timedelta(days=2)
entity_dbs_qry = model.Entity.query(model.Entity.created >= test_date)
entity_dbs = entity_dbs_qry.order(-model.Run.created).fetch()
return helpers.make_response(entity_dbs, model.Entity.FIELDS)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment