[Django]-Django: how to extend an existing model

3đź‘Ť

The reason why it’s difficult is because of the object-relational impedance mismatch (love that phrase). Objects and classes do not map perfectly onto relational databases: ORMs like Django’s attempt to smooth out the edges, but there are some places where the differences are just too great. Inheritance is one of these: there is simply no way to make one table “inherit” from another, so it has to be simulated via Foreign Keys or the like.

Anyway, for your actual problem, I can’t really see what’s going on but one possible way to fix it would be to subclass ProductAdmin as well, and specifically set the model attribute to your subclassed model.

Leave a comment