Viewed 15k times
In the following django model:
class MyModel(models.Model):
published = models.BooleanField(default=False)
pub_date = models.DateTimeField('date published')
I want the pub_date field to be automatically updated with the current date, every time the published field changes to True.
After creating the celery task
set_race_as_inactive, we need to call this celery task.We will call this task whenever we save a new
race_objectinto our database. So, whenever a newrace_objectwill be saved, a celery task will be fired which will execute only after theend_timeof therace_object.We will call the task using
apply_async()and pass theetaargument as theend_timeof therace_object.