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) #youtube id
I have done some STI in Rails before, but never in django. Is this how it's done in django? Will it only create one table having all the fields in all the models? Will it add a type column?
There will be two tables created, one for Picture, and one for Video. It will not be possible to create a query that returns both types.