0

I need to check if a contract is about to end and, if so, send a warning mail. I don't know how to approach it. Using a script? A kind of view?.

So far, I've see there's an email library I could use and maybe with a query in a views.py but I don't know how to trigger automatically (maybe cron?).

To sum up, I want to check the ending date of all the contracts and if any of them is gonna end in, let's say, 15 days send an email with the data related to that contract.

Any suggestions are welcome :)

 class Contract(models.Model):
    person        = models.ForeignKey(Person) #person hired
    project       = models.ForeignKey(Project, blank = True, null = True) #related project
    starting_date = models.DateField(blank = True, null = True)
    ending_date   = models.DateField(blank = True, null = True)
loar
  • 1,505
  • 1
  • 15
  • 34
  • This is a straightfoward queue task, use Celery or Django-RQ (other options available as well) to setup this kind of task, – petkostas Apr 01 '15 at 08:42
  • If you are going to go cron, you can write your script as a custom management command that you can call through manage.py. – Selcuk Apr 01 '15 at 09:38

0 Answers0