Build With Django

Learn to make Django applications from practical, real-world examples.

Celery Progress Bar Demo

A few examples illustrating what you can do with celery-progress.

Default Functionality


CeleryProgressBar.initProgressBar(taskUrl);
                
 
Waiting for progress to start...
 
Waiting for progress to start...

Custom Progress


function customProgress(progressBarElement, progressBarMessageElement, progress) {
    progressBarElement.innerHTML = Array(parseInt(progress.percent)).join("😊");
    progressBarMessageElement.innerHTML = (
      "about " + progress.percent + "% of the way through " + progress.total + ' custom thingies.'
    );
}
CeleryProgressBar.initProgressBar(taskUrl, {
    onProgress: customProgress
});
                
 
Waiting for progress to start...
 
Waiting for progress to start...

Custom Success/Error


function customSuccess(progressBarElement, progressBarMessageElement) {
    progressBarElement.innerHTML = (
     '<figure class="image"><img src="/static/projects/images/aww-yeah.jpg"></figure>'
    )
    progressBarElement.style.backgroundColor = '#fff';
    progressBarMessageElement.innerHTML = 'success!'
}
function customError(progressBarElement, progressBarMessageElement) {
    progressBarElement.innerHTML = (
     '<figure class="image"><img src="/static/projects/images/okay-guy.jpg"></figure>'
    )
    progressBarElement.style.backgroundColor = '#fff';
    progressBarMessageElement.innerHTML = 'shucks.'
}
CeleryProgressBar.initProgressBar(taskUrl, {
    onSuccess: customSuccess,
    onError: customError,
});
                
 
Waiting for progress to start...
 
Waiting for progress to start...

Level Up your Django Game

Follow this page to get updates, content and other goodies about building SaaS applications with Django. No spam. Unsubscribe anytime.