コード例 #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
ファイル: admin.py プロジェクト: openhealthcare/opal
    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"]