In this SO question, I see the following:
class MediaContent(models.Model):
uploader = models.ForeignKey(User)
title = models.CharField(max_length=100)
created = models.DateTimeField(auto_now_add=True)
def draw_item(self):
pass
class Meta:
abstract = True
class Picture(MediaContent):
picture = models.ImageField(upload_to='pictures')
class Video(MediaContent):
identifier = models.CharField(max_length=30)
I used to do some STI in Rails, but have never been to django. This is how it is done in django? Will he create only one table with all fields in all models? Will it add a type column?
source
share