Commit f4c080dd authored by BaiJiangJie's avatar BaiJiangJie

[Update] API允许批量删除用户,修改前端提示信息逻辑

parent b3e20b8b
...@@ -60,8 +60,10 @@ class UserViewSet(IDInCacheFilterMixin, BulkModelViewSet): ...@@ -60,8 +60,10 @@ class UserViewSet(IDInCacheFilterMixin, BulkModelViewSet):
self.permission_classes = (IsOrgAdminOrAppUser,) self.permission_classes = (IsOrgAdminOrAppUser,)
return super().get_permissions() return super().get_permissions()
def allow_bulk_destroy(self, qs, filtered): def perform_bulk_destroy(self, objects):
return False for obj in objects:
self.check_object_permissions(self.request, obj)
self.perform_destroy(obj)
def perform_bulk_update(self, serializer): def perform_bulk_update(self, serializer):
# TODO: 需要测试 # TODO: 需要测试
......
...@@ -258,25 +258,28 @@ $(document).ready(function(){ ...@@ -258,25 +258,28 @@ $(document).ready(function(){
},function () { },function () {
function success(data) { function success(data) {
url = setUrlParam(the_url, 'spm', data.spm); url = setUrlParam(the_url, 'spm', data.spm);
function success() {
var msg = "{% trans 'User Deleted.' %}";
swal("{% trans 'User Delete' %}", msg, "success");
}
function fail() {
var msg = "{% trans 'User Deleting failed.' %}";
swal("{% trans 'User Delete' %}", msg, "error");
}
requestApi({ requestApi({
url:url, url:url,
method:'DELETE', method:'DELETE',
flash_message:true,
success:reloadPage, success:reloadPage,
flash_message:false, error: fail
}); });
var msg = "{% trans 'User Deleted.' %}";
swal("{% trans 'User Delete' %}", msg, "success");
}
function fail() {
var msg = "{% trans 'User Deleting failed.' %}";
swal("{% trans 'User Delete' %}", msg, "error");
} }
requestApi({ requestApi({
url: "{% url 'api-common:resources-cache' %}", url: "{% url 'api-common:resources-cache' %}",
method:'POST', method:'POST',
body:JSON.stringify(data), body:JSON.stringify(data),
flash_message:false,
success:success, success:success,
error:fail
}) })
}) })
} }
......
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