Skip to content

Instantly share code, notes, and snippets.

@fandrefh
Created December 3, 2019 16:59
Show Gist options
  • Save fandrefh/90249e7c9018a34889f4677514375001 to your computer and use it in GitHub Desktop.
Save fandrefh/90249e7c9018a34889f4677514375001 to your computer and use it in GitHub Desktop.
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