示例#1
0
文件: api.py 项目: nocko/cfmi
def admin_list_pi():
    active_projects = Project.query.filter(Project.is_active==True)
    if 'year' in request.args and 'month' in request.args:
        active_projects = limit_month(active_projects,
            int(request.args['year']), 
            int(request.args['month']))
    pi_list = []
    for project in active_projects:
        if not project.pi in pi_list:
            pi_list.append(project.pi)
    flat_list = [flatten(pi, attrib_filter=['name','username','id']) for pi in pi_list]
    return jsonify({'name':"active_pis", 'object_list': flat_list})