Пример #1
0
    def clean_name(self):
        object_class = self.instance.__class__
        name = self.cleaned_data["name"]
        if synonym_exists(object_class, name):
            raise ValidationError("A synonym of that name already exists")

        return self.cleaned_data["name"]
Пример #2
0
    def clean_name(self):
        object_class = self.instance.__class__
        name = self.cleaned_data["name"]
        if synonym_exists(object_class, name):
            raise ValidationError(
                "A synonym of that name already exists"
            )

        return self.cleaned_data["name"]