Django Celery with DropZone.JS

I'm trying to make a progress bar using celery and dropzone with Django but I'm stuck here , I can't add the task id into templates I'm sending messages from praw to users from the csv file from dropzone so I want to make a progress bar and display it on template

Here's my template view

<div class='progress-wrapper'>
  <div id='progress-bar' class='progress-bar' style="background-color: #68a9ef; width: 0%;">&nbsp;</div>
<div id="progress-bar-message">Waiting for progress to start...</div>

<script src="{% static 'celery_progress/celery_progress.js' %}"></script>

  document.addEventListener("DOMContentLoaded", function() {
    Dropzone.autoDiscover = false
    const myDropzone = new Dropzone('#message_dropzone',{
          var progressUrl = "{% url 'celery_progress:task_status' task_id %}";

and here's my views

def sending_message(request):
    if request.method == 'POST':
        file = request.FILES['file']
        df = pd.read_csv(file)
        data = df["username"]
        if len(data) > 0:
                for user in data:
                    task = send_pm.delay(user, subject, message, subreddit, username, password,account.client_id,account.client_secret,account.proxy,counter)
                    account.messages = len(data)

                context = {"task_id":}
                return render(request, 'dashboard/dashboard_message.html',context)
        return JsonResponse({"ex":True, "msg": "No Users in the csv"})

    return redirect('Send Message')
Back to Top