def update_scan_list(request: Request, scan_list_id: int) -> Response:
"""Update an existing list."""
try:
# TODO: Check if list is editable (and by current user)
scan_list = ScanList.objects.get(pk=scan_list_id,
token=request.data['token'])
scan_list.name = request.data['listname']
scan_list.description = request.data['description']
scan_list.private = request.data['isprivate']
# save tags
scan_list.save_tags(request.data['tags'])
# save columns
scan_list.save_columns(request.data['columns'])
scan_list.save()
return Response({
'type': 'success',
'message': 'ok',
})
except KeyError as e:
raise ParseError
except ScanList.DoesNotExist:
raise NotFound
评论列表
文章目录