修复 删除accountfile

This commit is contained in:
王思川 2024-06-17 10:48:22 +08:00
parent 2103e3cdc3
commit 87cb48f15b
3 changed files with 6 additions and 2 deletions

View File

@ -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>

View File

@ -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)

View File

@ -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) {