[Answer]-Django sending mail using pre_save

1👍

Under the Book models, create the signal function.

class Book(models.Model):
    [..........]

def send_update(sender, instance, created, **kwargs):
    if instance.author_name:
        message = "Book is updated"
        subject = "Updates"
        send_mail(subject, message, your_email,
            [instance.email,])

post_save.connect(send_update, sender=Book)

Leave a comment