def get_user_plans(user): return [{ 'plan_id': plan.key().id(), 'status': plan.status, 'plan_time': (plan.plan_time + utc_fix).strftime('%Y-%m-%d %H:%M'), 'exec_time': (plan.exec_time + utc_fix).strftime('%Y-%m-%d %H:%M') if plan.exec_time else None, 'interval': plan.interval, 'result': plan.result, } for plan in Plan.all().filter('user ='******'-plan_time')]
def post(self): user_id = self.request.get('user_id') users = User.all().filter('owner =', current_user) the_user = users.filter('user_id =', user_id) if not the_user.count(): return the_user = the_user.fetch(1)[0] plans = Plan.all().filter('user ='******'users': convert_users_list(users), 'plans': get_user_plans(users[0]) if users else [], } json.dump(data, self.response.out)