def save(self, *args, **kwargs):
"""save"""
try:
int(self.gender)
except ValueError:
self.gender = 0
super(Contact, self).save(*args, **kwargs)
if not self.uuid:
ascii_name = unicodedata.normalize('NFKD', unicode(self.fullname)).encode("ascii", 'ignore')
name = u'{0}-contact-{1}-{2}-{3}'.format(project_settings.SECRET_KEY, self.id, ascii_name, self.email)
name = unicodedata.normalize('NFKD', unicode(name)).encode("ascii", 'ignore')
self.uuid = unicode(uuid.uuid5(uuid.NAMESPACE_URL, name))
return super(Contact, self).save()
if self.entity.is_single_contact:
#force the entity name for ordering
self.entity.save()
评论列表
文章目录