Add support for notification emails on m2m changes

Unfortunately, we'll send one email for each m2m field, instead of
collecting them to a single one. That's because there is no signal
delivered at the end of them all, there will be one sent for each field.

Luckily we don't have a lot of m2m fields at this point, and no model
has more than one, so at this point that part is not a problem.

It also means that if a regular field *and* an m2m field is changed,
then we will get two notifications.

Finally, enable these notifications for the Organisation fields, meaning
we will get a notification when an Organisation changes managers, which
was not working before.
This commit is contained in:
Magnus Hagander
2017-12-13 20:49:52 +01:00
parent 10ec8bfd44
commit 2cbf0bf048
2 changed files with 27 additions and 1 deletions

View File

@ -125,6 +125,7 @@ class Organisation(models.Model):
lastconfirmed = models.DateTimeField(null=False, blank=False, auto_now_add=True)
send_notification = True
send_m2m_notification = True
def __unicode__(self):
return self.name