def Current(user, which="all"):
date = tools.local_time(user.get_timezone(), datetime.today())
keys = []
if which in ["all", "year"]:
annual_id = ndb.Key('Goal', datetime.strftime(date, "%Y"), parent=user.key)
keys.append(annual_id)
if which in ["all", "month"]:
monthly_id = ndb.Key('Goal', datetime.strftime(date, "%Y-%m"), parent=user.key)
keys.append(monthly_id)
if which in ["all", "longterm"]:
longterm_id = ndb.Key('Goal', datetime.strftime(date, "longterm"), parent=user.key)
keys.append(longterm_id)
goals = ndb.get_multi(keys)
return [g for g in goals]
评论列表
文章目录