Q:

How to display an animated icon during python function processing in django?

I am trying to develop an application with Django. I have a form in my HTML file which will pass same data to the server. At server side, my python function(called submit) will receive the posted values and process them and then redirect the user to a new page. 
Question: How can I show a loading gif to the user until my python function is processing posted data and finished? I searched on the stackoverflow about this question and there are some answers (this and this and this) but the answers are for finishing Ajax functions, or there is no explanation how can I identify when my python function has been finished or is for flask framework.
Any help would be greatly appreciated.

A:

This is rather simple. First you will have to download font-awesome.css from here http://fontawesome.io/.
Then create one element like <span class="fa fa-spinner"></span> this element will be hidden by default. Set it visible at the beginning of your ajax call and hide it once you have receive the response.
If you want to show your own image, the logic should be the same.

