Skip to content

Instantly share code, notes, and snippets.

@ebsaral
Created July 12, 2017 12:08
Show Gist options
  • Save ebsaral/32431cee7c1b8cb0bc70b7a98bd459bf to your computer and use it in GitHub Desktop.
Save ebsaral/32431cee7c1b8cb0bc70b7a98bd459bf to your computer and use it in GitHub Desktop.
Converting a model to multi-table inheritance in Django - Final Model Structure
class Address(models.Model):
name = models.CharField(max_length=20)
owner = models.ForeignKey('another_app.Owner')
class HomeAddress(Address):
housekeeper = models.CharField(max_length=50)
class WorkAddress(Address):
boss = models.CharField(max_length=50)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment