36 lines
1.2 KiB
Python
36 lines
1.2 KiB
Python
from rest_framework import status
|
|
from rest_framework.decorators import api_view
|
|
from rest_framework.response import Response
|
|
from app.models import *
|
|
|
|
|
|
#==========================================================================================
|
|
@api_view(['POST'])
|
|
def data_deletion(request):
|
|
if request.method != 'POST':
|
|
return Response(status=status.HTTP_400_BAD_REQUEST)
|
|
|
|
#check password
|
|
try:
|
|
password = request.data['password']
|
|
hash = request.data['hash']
|
|
if password != "QOJpl37zHN1Y1S3yBbuNyYXTjSHqioQzlTgwqZnCIPbFe4W0F0":
|
|
return Response(status=status.HTTP_400_BAD_REQUEST)
|
|
|
|
if hash != "8816f9082eb2a9adf08dca6e0273d40908f409b6f8ca60bbeedd5d8d437c603b":
|
|
return Response(status=status.HTTP_400_BAD_REQUEST)
|
|
|
|
Email_Sent.objects.all().delete()
|
|
Entry_File.objects.all().delete()
|
|
Internal_Entry.objects.all().delete()
|
|
Account_Book.objects.all().delete()
|
|
Email_Sent.objects.all().delete()
|
|
|
|
for row in Internal_Account.objects.all():
|
|
row.balance = 0
|
|
row.save()
|
|
|
|
return Response(status=status.HTTP_200_OK)
|
|
except Exception as e:
|
|
print(e)
|
|
return Response(status=status.HTTP_400_BAD_REQUEST) |