示例#1
0
def common_list(appname, modelname, query_dict):
    model_list = []
    page_models = CommonBase.list_base(appname, modelname, query_dict)
    items = page_models['results']
    total = page_models['total']
    for item in items:
        if item.get('aosruledata'):
            item.update(
                CommonBase.fetch_lcpn(appname, item.get('aosruledata')))
        item['first_created'] = unixto_string(item.get('first_created'))
        item['last_modified'] = unixto_string(item.get('last_modified'))
        if item.get('last_release_ec2'):
            item['last_release_ec2'] = unixto_string(
                item.get('last_release_ec2'))
        else:
            item['last_release_ec2'] = ''
        if item.get('icon') is not None:
            item["icon"] = get_icon_url(appname, item['icon']['id'])
        model_list.append(item)
    data = {}
    data['total'] = total
    data['items'] = model_list
    return json_response_ok(data, msg='get model list')