我正在使用 Django 和 VueJS 做一个小项目,我想做一个批量删除,我正在发送一个我的 ID 的数组对象,在正文中使用 Axios:[1,2,3]
这是我的代码:
getAPI({
method: 'DELETE',
url: 'api/contact/delete/',
data:{
ids: this.selected
}
}).then((response) => {
console.log(response.data)
})
我如何在 django 中循环我的 id 这是我的功能:
@action(methods=['delete'], detail=False)
def delete(self, request):
for i in request.body:
print(request[i])