jazzband / django-polymorphic

Improved Django model inheritance with automatic downcasting

Home Page:https://django-polymorphic.readthedocs.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Can a child model inherit from multiple parent PolymorphicModel classes?

jaradc opened this issue · comments

Any foreseeable issues with this model design?

class Content(PolymorphicModel):
    title = ...
    description = ...

class Product(PolymorphicModel):
    price = ...

class Report(Content, Product): # <-- this OK?
    ...

class Post(Content):
    pass

class Listing(Product):
    pass

Can a downstream model inherit from multiple parent PolymorphicModel classes? I'm not seeing conflicts yet, but I'm an amateur.

Stupid question. I AM seeing issues. The field 'id' from the parent model 'content' clashes with the 'id' field from parent model 'product'. So it won't work.