In my blog I decided to allow users to edit posts (I am using Django), but I am not sure what is the right implementation for my models to do that. Is a good idea to use multi-table inheritance as my code below? I also want to keep track of all the posts, originals as the every new edited as well.
class Post(models.Model):
title = models.CharField(max_length=500)
text = models.TextField()
creation_date = models.DateTimeField(auto_now_add=True)
user = models.ForeignKey(User)
def __unicode__(self):
return "%s %s by %s" % (self.title, self.creation_date, self.user)
class Edit(Post):
edited_date = models.DateTimeField(auto_now_add=True)
editor = models.OneToOneField(User)
def __unicode__(self):
return "%s edited by %s" % (self.convention, self.login)