66from django .utils .module_loading import import_string
77from django_celery_boost .models import CeleryTaskModel
88
9- from country_workspace .storages import MEDIA_STORAGE
10-
119
1210class AsyncJob (CeleryTaskModel , models .Model ):
1311 class JobType (models .TextChoices ):
@@ -18,7 +16,7 @@ class JobType(models.TextChoices):
1816 type = models .CharField (max_length = 50 , choices = JobType .choices )
1917 program = models .ForeignKey ("Program" , related_name = "jobs" , on_delete = models .CASCADE , null = True , blank = True )
2018 batch = models .ForeignKey ("Batch" , related_name = "jobs" , on_delete = models .CASCADE , null = True , blank = True )
21- file = models .FileField (storage = MEDIA_STORAGE , upload_to = "updates" , null = True , blank = True )
19+ file = models .FileField (upload_to = "updates" , null = True , blank = True )
2220 config = models .JSONField (default = dict , blank = True )
2321 action = models .CharField (max_length = 500 , blank = True , null = True )
2422 description = models .CharField (max_length = 255 , blank = True , null = True )
@@ -39,7 +37,7 @@ def queue_position(self) -> int:
3937
4038 @property
4139 def started (self ) -> str :
42- return self .task_info [ "started_at" ]
40+ return self .task_info . get ( "started_at" , None )
4341
4442 def execute (self ) -> Any :
4543 sid = None
0 commit comments