Commit 7984f3af authored by haowang's avatar haowang

fix code

parent ff6cf19b
......@@ -55,10 +55,16 @@ class BrandInfoView(APIView):
data = self.rpc['neptune/commodity/brand/info'](id_=id_).unwrap()
classify_infos = self.rpc['neptune/commodity/classify/infos'](brand_id=id_).unwrap()
data['classify_infos'] = [{'id': obj.get('id'), 'cn_name': obj.get('cn_name')} for obj in classify_infos] if classify_infos else []
if classify_infos:
data['classify_infos'] = [{'id': obj.get('id'), 'cn_name': obj.get('cn_name')} for obj in classify_infos]
else:
data['classify_infos'] = []
category_ids = self.rpc['neptune/commodity/brand/category_ids'](id_=id_).unwrap()
category_infos = self.rpc['neptune/commodity/category/infos'](ids=category_ids).unwrap()
data['category_infos'] = [{'id': obj.get('id'), 'cn_name': obj.get('cn_name')} for obj in category_infos] if category_infos else []
if category_infos:
data['category_infos'] = [{'id': obj.get('id'), 'cn_name': obj.get('cn_name')} for obj in category_infos]
else:
data['category_infos'] = []
return data
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment