Advertisement
Guest User

Untitled

a guest
Apr 23rd, 2019
117
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.58 KB | None | 0 0
  1. def save(self, *args, **kwargs):
  2.     should_send_email = False
  3.     if self.pk:
  4.         deuda_actual = Enterprise.objects.get(pk=self.pk).ammount_of_doubt
  5.         if self.has_doubt:
  6.             if self.ammount_of_doubt != deuda_actual:
  7.                 should_send_email = True
  8.     else:
  9.         should_send_email = self.has_doubt
  10.  
  11.     if should_send_email:
  12.         mensaje = """Hola asdasda """
  13.         send_mail("Notificacion", mensaje, "misclientes@pescatun.alinet.cu", [self.email], fail_silently=True)
  14.         self.emailed = True
  15.     super(Enterprise, self).save(*args, **kwargs)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement