Created
December 3, 2019 16:59
-
-
Save fandrefh/90249e7c9018a34889f4677514375001 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def clean(self): | |
model = self.__class__ | |
if model.objects.count() > 0 and self.id != model.objects.get().id: | |
raise ValidationError("Você já tem um perfil cadastrado.") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment