[Fixed]-Losing subclass fields when serializing in django?

1πŸ‘

βœ…

On that model design, you will have 2 tables in database:

  • yourapp_mytag that will have primary key column (normal auto-increment column), all columns inherited from TagBase (as long as TagBase is abstract) and column user – foreign key to model User
  • yourapp_mymptttag tht will have primary key column that is also foreign key to MyTag model and columns for mptt. There won’t be any columns inherited from MyTag.

That means: there are no columns inherited from MyTag in model MyMpttTag, there are only references to actual columns in MyTag.

In serialization there will be 2 type of objects: MyMpttTag and MyTag.

πŸ‘€GwynBleidD

Leave a comment