Commit a500ef19 authored by haowang's avatar haowang

modify tag filter create support batch

parent 4909c6ee
......@@ -167,14 +167,18 @@ class TagFilterList(APIView):
class TagFilterCreate(APIView):
def post(self, request):
tag_name = request.POST.get('tag_name', None)
tag_id = request.POST.get('tag_id', None)
if not tag_id or not tag_name:
tag_infos = json.loads(request.POST.get('tag_infos', '[]'))
if not tag_infos:
return {'message': '参数不完整'}
data = self.rpc['venus/sun/tag/filter/add'](tag_id=tag_id, tag_name=tag_name).unwrap()
if not data:
return {'message': '创建失败'}
for tag_info in tag_infos:
tag_name = tag_info.get('tag_name', None)
tag_id = tag_info.get('tag_id', None)
if not tag_id or not tag_name:
return {'message': '参数不完整'}
data = self.rpc['venus/sun/tag/filter/add'](tag_id=tag_id, tag_name=tag_name).unwrap()
if not data:
return {'message': '创建失败'}
return {'message': '创建成功'}
......
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