added user account delete feature
This commit is contained in:
@ -1,7 +1,7 @@
|
||||
from sys import prefix
|
||||
from rest_framework import urlpatterns
|
||||
from rest_framework.routers import DefaultRouter
|
||||
from .views import LocationViewSet, Location_lineViewSet, Location_polygonViewSet, Jpn_Main_PerfViewSet, Jpn_PerfViewSet, LocationsInPerf, SubInPerf, ExtentForSubPerf, SubPerfInMainPerf, ExtentForMainPerf, LocationsInSubPerf, CatView, RegistrationAPI, LoginAPI, UserAPI, UserActionViewset, UserMakeActionViewset, UserDestinations, UpdateOrder, LocationInBound, DeleteDestination, CustomAreaLocations, GetAllGifuAreas, CustomAreaNames, userDetials, UserTracksViewSet, CatByCity, ChangePasswordView, GoalImageViewSet, CheckinImageViewSet, ExtentForLocations
|
||||
from .views import LocationViewSet, Location_lineViewSet, Location_polygonViewSet, Jpn_Main_PerfViewSet, Jpn_PerfViewSet, LocationsInPerf, SubInPerf, ExtentForSubPerf, SubPerfInMainPerf, ExtentForMainPerf, LocationsInSubPerf, CatView, RegistrationAPI, LoginAPI, UserAPI, UserActionViewset, UserMakeActionViewset, UserDestinations, UpdateOrder, LocationInBound, DeleteDestination, CustomAreaLocations, GetAllGifuAreas, CustomAreaNames, userDetials, UserTracksViewSet, CatByCity, ChangePasswordView, GoalImageViewSet, CheckinImageViewSet, ExtentForLocations, DeleteAccount
|
||||
from django.urls import path, include
|
||||
from knox import views as knox_views
|
||||
|
||||
@ -45,6 +45,7 @@ urlpatterns += [
|
||||
path('delete_destination/', DeleteDestination, name='delete_detination'),
|
||||
path('customareanames/', CustomAreaNames, name='custom_area_name'),
|
||||
path('userdetials/', userDetials, name='user_detials'),
|
||||
path('change-password/', ChangePasswordView.as_view(), name='change-password')
|
||||
path('change-password/', ChangePasswordView.as_view(), name='change-password'),
|
||||
path('delete-account/', DeleteAccount, name="delete-account"),
|
||||
# path('goal-image/', GoalImageViewSet.as_view(), name='goal-image')
|
||||
]
|
||||
13
rog/views.py
13
rog/views.py
@ -27,6 +27,7 @@ from rest_framework.decorators import api_view
|
||||
from rest_framework.decorators import api_view, permission_classes
|
||||
from rest_framework.parsers import JSONParser, MultiPartParser
|
||||
from django.views.decorators.csrf import csrf_exempt
|
||||
import uuid
|
||||
|
||||
|
||||
|
||||
@ -346,6 +347,18 @@ def userDetials(request):
|
||||
serializer = RogUserSerializer(rogUser, many=True)
|
||||
return JsonResponse(serializer.data, safe=False)
|
||||
|
||||
@api_view(['GET'])
|
||||
@permission_classes((IsAuthenticated, ))
|
||||
def DeleteAccount(request):
|
||||
usr = request.user;
|
||||
#print("user is" + usr)
|
||||
if(usr):
|
||||
#usr.delete()
|
||||
usr.email = usr.email + "_res" + str(uuid.uuid4())
|
||||
usr.save();
|
||||
AuthToken.objects.filter(user=usr).delete()
|
||||
return Response({"result":"user deleted"})
|
||||
return Response({"result":"user not found"})
|
||||
|
||||
|
||||
def UserActionViewset(request):
|
||||
|
||||
Reference in New Issue
Block a user