def clean_name(self):
        data = self.cleaned_data['name']
        existing = User.objects.filter(name=data).exclude(pk=self.instance.id)
        if existing:
            raise forms.ValidationError(
                _("User with username %s already exists.") % data)
        return data
Clean name
dataset/ETHPy150Open treeio/treeio/treeio/account/forms.py/AccountForm.clean_name