python - How to query for entity commited yesterday by DateTimeProperty() -
i have calendar model records number of contributions users make per day:
class calmodel(db.model): user = db.referenceproperty(usermodel, collection_name = "calendar") date = db.datetimeproperty(auto_now_add = true) contrib = db.integerproperty(required = true)
i want query calmodel entity date attribute yesterday. how specify datetime object day yesterday? (the strftime format default)
something goes like:
cal = calmodel.all().filter("date", datetimeobject).get()
figured out.
yesterday = datetime.today() - timedelta(1) query = calmodel.all().ancestor(calendar_key()).filter("user", user).filter("date", yesterday).get()
Comments
Post a Comment