

def clean_name(self):
    "Ensures a contact with the same name doesn't already exists"
    instance = getattr(self, 'instance', None)
    name = self.cleaned_data['name']
    if (instance and (not instance.id)):
        slug = unicode(self).replace(' ', '-')
        slug = defaultfilters.slugify(unidecode(slug))
        if ContactType.objects.filter(slug=slug).exists():
            raise forms.ValidationError(_('Contact Type with such name already exists.'))
    return name

dataset/ETHPy150Open treeio/treeio/treeio/identities/forms.py ContactTypeForm.clean_name/VarMisuse@50/81 `name`->`self`