djangodjango-inheritance

how to associate existing parent with child in django multitable inheritance


I have an existing parent entity with many existing records:

class Entity(models.Model):
    name = models.CharField('Name', max_length=64, db_index=True) 

I also have child objects that extend using django multi table inheritance:

class Investor(Entity):
    investor_name = models.CharField(max_length=255)

I want to create new Investor objects that maybe existing Entities.

How do I associate and create Investors with existing Entities?


Solution

  • I found a way you can do this like:

    child = Restaurant(place_ptr=place)
    child.save_base(raw=True)
    

    You can view the full thread here: https://code.djangoproject.com/ticket/7623