So I made model VerificationToken
class VerificationToken(models.Model):
user = models.ForeignKey(User, on_delete=models.CASCADE)
code = models.CharField(max_length=4)
date_created = models.DateTimeField(auto_now_add=True)
@property
def expiration(self):
lifetime = timedelta(minutes=10)
expire = self.date_created + lifetime
return expire
and this model have an expiration property. Is there a way to make this model delete itself after it expires?