1π
β
I donβt see an issue with a Job
model that your background processing updates and then a view that your JavaScript polls. It may be useful in the future for analytics, too β you could track how long processing takes on average for files of a specific size, for example.
Roughly, something like this:
class Job(models.Model):
user = models.ForeignKey('User', related_name='jobs')
status = models.CharField(max_length=255)
created_on = models.DateTimeField(auto_now_add=True)
updated_at = models.DateTimeField(auto_now=True)
Then, on file upload, create a new Job
, and pass it to your front-end so that it can poll the job status view you create.
π€J. McBride
Source:stackexchange.com