Created
July 13, 2012 00:54
-
-
Save flaviodesousa/3102088 to your computer and use it in GitHub Desktop.
Exemplo de modelo de documento versionado
This file contains 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
class Documento(models.Model): | |
nome = models.CharField(max_length=128) | |
autor = models.CharField(max_length=128) | |
versao_atual = models.ForeignKey('Versao', related_name='+') | |
class Versao(models.Model): | |
texto = models.TextField() | |
criacao = models.DateTimeField(auto_now_add=True) | |
documento = models.ForeignKey(Documento, related_name='versoes') | |
class Meta: | |
verbose_name = u'Versão' | |
verbose_name_plural = u'Versões' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment