Merged in [8870] from rjsparks@nostrum.com:
Inform the secretariat when a duplicate Alias.name is created that isn't already a duplicate Person.name. Improve the message that's sent when either duplicate Person or Alias names are detected. - Legacy-Id: 8893 Note: SVN reference [8870] has been migrated to Git commit 8e1abfa833f528bccf0f61a2a767f3923255e137
This commit is contained in:
parent
c065e59b89
commit
630a263ef7
|
@ -127,6 +127,20 @@ class Alias(models.Model):
|
||||||
"""
|
"""
|
||||||
person = models.ForeignKey(Person)
|
person = models.ForeignKey(Person)
|
||||||
name = models.CharField(max_length=255, db_index=True)
|
name = models.CharField(max_length=255, db_index=True)
|
||||||
|
|
||||||
|
def save(self, *args, **kwargs):
|
||||||
|
created = not self.pk
|
||||||
|
super(Alias, self).save(*args, **kwargs)
|
||||||
|
if created:
|
||||||
|
if Alias.objects.filter(name=self.name).exclude(person__name=self.name).count() > 1 :
|
||||||
|
msg = render_to_string('person/mail/possible_duplicates.txt',
|
||||||
|
dict(name=self.name,
|
||||||
|
persons=Person.objects.filter(alias__name=self.name),
|
||||||
|
settings=settings
|
||||||
|
))
|
||||||
|
send_mail_preformatted(None, msg)
|
||||||
|
|
||||||
|
|
||||||
def __unicode__(self):
|
def __unicode__(self):
|
||||||
return self.name
|
return self.name
|
||||||
class Meta:
|
class Meta:
|
||||||
|
|
|
@ -2,15 +2,16 @@
|
||||||
To: <iesg-secretary@ietf.org>
|
To: <iesg-secretary@ietf.org>
|
||||||
Subject: Possible duplicate Person objects for {{name}}
|
Subject: Possible duplicate Person objects for {{name}}
|
||||||
|
|
||||||
A new Person object was just created for {{name}}.
|
A new Person and/or Alias object was just created for {{name}}.
|
||||||
|
|
||||||
There are now {{persons|length}} Person objects sharing that name.
|
There are now {{persons|length}} Person objects sharing that name.
|
||||||
|
|
||||||
Please check to see if they represent the same actual person, and if so, merge the objects as appropriate.
|
Please check to see if they represent the same actual person, and if so, merge the objects as appropriate.
|
||||||
|
|
||||||
{% for person in persons %}Person {{forloop.counter}} (pk={{person.pk}})
|
{% for person in persons %}Person {{forloop.counter}} {{ person.name }} (pk={{person.pk}})
|
||||||
time: {{person.time}}
|
time: {{person.time}}
|
||||||
ascii: {{person.ascii}}
|
ascii: {{person.ascii}}
|
||||||
email: {% for email in person.email_set.all %}{{ email.address }} {% endfor %}
|
email: {% for email in person.email_set.all %}{{ email.address }} {% endfor %}
|
||||||
|
aliases: {{ person.alias_set.all|join:", " }}
|
||||||
|
|
||||||
{% endfor %} {% endautoescape %}
|
{% endfor %} {% endautoescape %}
|
||||||
|
|
Loading…
Reference in a new issue