修复 删除accountfile
This commit is contained in:
parent
2103e3cdc3
commit
87cb48f15b
|
@ -65,7 +65,7 @@
|
|||
id="deleteBtn"
|
||||
class="delete-btn"
|
||||
style="color: red"
|
||||
data-target_id="{{ item.id }}"
|
||||
data-id="{{ item.id }}"
|
||||
data-bs-toggle="modal"
|
||||
data-bs-target="#deleteModal">删除</a>
|
||||
</td>
|
||||
|
|
|
@ -197,8 +197,12 @@ def user_permissions_list(request):
|
|||
def delete_account_profile(request):
|
||||
if request.method == 'GET':
|
||||
user_id = request.GET.get('id')
|
||||
if not user_id:
|
||||
return JsonResponse({"message": "缺少id参数"}, status=400)
|
||||
|
||||
AccountProfile.objects.filter(user_id=user_id).delete()
|
||||
return JsonResponse({"message": "删除成功"})
|
||||
|
||||
return JsonResponse({"message": "无效的请求方法"}, status=405)
|
||||
|
||||
|
||||
|
|
|
@ -29,8 +29,8 @@
|
|||
if (event.target.id === 'deleteBtn') {
|
||||
// 打开删除模态框
|
||||
targetIdToDelete = $(this).data('id');
|
||||
$('#deleteModal').modal('show');
|
||||
debugger
|
||||
$('#deleteModal').modal('show');
|
||||
} else if (event.target.id === 'confirmDeleteBtn') {
|
||||
// 确认删除
|
||||
if (targetIdToDelete !== null) {
|
||||
|
|
Loading…
Reference in New Issue