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_object
into our database. So, whenever a newrace_object
will be saved, a celery task will be fired which will execute only after theend_time
of therace_object
.We will call the task using
apply_async()
and pass theeta
argument as theend_time
of therace_object
.