Django - show loading message during long processing

前端 未结 7 1433
野的像风
野的像风 2020-12-03 03:54

How can I show a please wait loading message from a django view?

I have a Django view that takes significant time to perform calculations on a large dataset

7条回答
  •  不思量自难忘°
    2020-12-03 04:24

    A workaround that I chose was to use beforunload and unload events to show the loading image. This can be used with or without window.load. In my case, it's the view that is taking a great amount of time and not the page loading, hence I not using window.load.

    The downside is that there is a false message that goes out to the user that the page is loading even when when the request has not even reached the server or it's taking much time. And if, for some reason, the request dies out, the user continues to think that the page is loading, and loading. But I'm living with this for now.

    P.S. I cannot comment yet hence posted this as an answer.

提交回复
热议问题