From 97bae9e940cb8d59cacdedf15a75a4a69dfd719b Mon Sep 17 00:00:00 2001 From: rizwanisready Date: Mon, 27 May 2024 16:03:41 +0530 Subject: [PATCH] solved account deleted bug --- accounts/api/views.py | 3 +-- accounts/forms.py | 1 - 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/accounts/api/views.py b/accounts/api/views.py index 0c7b59e..f51223f 100644 --- a/accounts/api/views.py +++ b/accounts/api/views.py @@ -937,7 +937,7 @@ class SoftDeletePrincipalAPIView(APIView): def delete(self, request, format=None): principal = request.user - if principal.deleted: # Check if already deleted + if not principal.is_active: # Check if already deleted return ApiResponse.error( status=status.HTTP_400_BAD_REQUEST, message="Account already deleted.", @@ -945,7 +945,6 @@ class SoftDeletePrincipalAPIView(APIView): ) principal.is_active = False - principal.deleted = True principal.save() return ApiResponse.success( status=status.HTTP_200_OK, diff --git a/accounts/forms.py b/accounts/forms.py index 3dbb6ce..d4d90ee 100644 --- a/accounts/forms.py +++ b/accounts/forms.py @@ -72,7 +72,6 @@ class IAmPrincipalForm(forms.ModelForm): "password", "confirm_password", "is_active", - "deleted", ] def __init__(self, *args, **kwargs):