I have a profile page where user can see all his information.
I want to create a button so the user can pull some specific external information.
The button should start a celery task, and when the task is completed, the user should get a message with "completed"
How can I do this?
<a href="/start-task/">Pull external info</a>
My "start-task" view:
def start_task(request):
get_external_user_info.delay(user=request.user)
return HttpResponse("Task started")
But how do I do a ajax check if the task is completed?
Do I need another view? How would that view look like?
You have to get task_id
After that using this id to ajax and get status
Check this Celery task status