Skip to content

Instantly share code, notes, and snippets.

@leydson-vieira
Created March 10, 2017 17:10
Show Gist options
  • Save leydson-vieira/e441c28fec26f58b809ee1676297780a to your computer and use it in GitHub Desktop.
Save leydson-vieira/e441c28fec26f58b809ee1676297780a to your computer and use it in GitHub Desktop.
def save(self, **kwargs):
'''
Sobrescreve o método save da classe alterando o slug da instância e atribuindo um UUID (Universal Unique Identifier).
'''
if not self.id:
self.slug = uuid.uuid4()
super().save(**kwargs)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment