Commit 54dc4c7b authored by 王浩's avatar 王浩

Merge branch 'haow/dev' into 'test'

modify tag filter create support batch modify tag filter delete to batch

See merge request !197
parents db4f5139 9ac79451
......@@ -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': '参数不完整'}
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': '创建失败'}
data = self.rpc['venus/sun/tag/filter/add'](tag_id=tag_id, tag_name=tag_name).unwrap()
if not data:
return {'message': '创建失败'}
return {'message': '创建成功'}
......@@ -182,14 +186,15 @@ class TagFilterCreate(APIView):
class TagFilterDelete(APIView):
def post(self, request):
id_ = request.POST.get('id', None)
if not id_:
ids = json.loads(request.POST.get('ids', '[]'))
if not ids:
return {'message': '参数不完整'}
data = self.rpc['venus/sun/tag/filter/delete'](id_=id_).unwrap()
for id_ in ids:
data = self.rpc['venus/sun/tag/filter/delete'](id_=id_).unwrap()
if not data:
return {'message': '操作失败'}
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