Ember-Django Rest: Delete an authorised user account from an admin account

89 Views Asked by At

If the user accounts are authenticated using jwt authentication, (backend - Django rest), how can I delete a user account from another account which is an admin account(superuser) ?

1

There are 1 best solutions below

2
On

You can use django admin panel or create view

class ExampleView(APIView):
    permission_classes = (IsAdminUser,)

    def delete(self, request, pk=None):
        user = get_object_or_404(User.objects, pk=pk)
        user.delete()
        return Response(status=status.HTTP_200_OK)

Then you have to link it with url containing pk parameter