Sending email to the users based on the due date in model using the celery, the due_date is something different from date when a task is created
Models.py
class Task(BaseModel):
name = models.CharField(max_length=255)
due_date = models.DateField(blank=True, null=True)
@shared_task
def send_email():
today = datetime.now()
tasks = Task.objects.filter(due_date__date=today)
for task in tasks:
# Send email task
Run this task daily. Celery Beat makes running periodic tasks easy - https://docs.celeryq.dev/en/stable/userguide/periodic-tasks.html#beat-custom-schedulers