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)