def delete(self, request, app_id): try: instance = ApiApplication.objects.get( owner=request.user, client_id=app_id, status=ApiApplicationStatus.active, ) except ApiApplication.DoesNotExist: raise ResourceDoesNotExist updated = ApiApplication.objects.filter(id=instance.id, ).update( status=ApiApplicationStatus.pending_deletion, ) if updated: transaction_id = uuid4().hex delete_api_application.apply_async( kwargs={ 'object_id': instance.id, 'transaction_id': transaction_id, }, countdown=3600, ) delete_logger.info('object.delete.queued', extra={ 'object_id': instance.id, 'transaction_id': transaction_id, 'model': type(instance).__name__, }) return Response(status=204)
def delete(self, request, app_id): try: instance = ApiApplication.objects.get( owner=request.user, client_id=app_id, status=ApiApplicationStatus.active, ) except ApiApplication.DoesNotExist: raise ResourceDoesNotExist updated = ApiApplication.objects.filter( id=instance.id, ).update( status=ApiApplicationStatus.pending_deletion, ) if updated: transaction_id = uuid4().hex delete_api_application.apply_async( kwargs={ 'object_id': instance.id, 'transaction_id': transaction_id, }, countdown=3600, ) delete_logger.info('object.delete.queued', extra={ 'object_id': instance.id, 'transaction_id': transaction_id, 'model': type(instance).__name__, }) return Response(status=204)