Here\'s the deal:
I got two db models, let\'s say ShoppingCart
and Order
. Following the DRY principle I\'d like to extract some common prop
First, here are two Django snippets that should be exactly what you're looking for:
Second, you might want to re-think your design and switch to the django.contrib content types framework which has a simple .model_class() method. (The first snippet posted above also uses the content type framework).
Third, you probably don't want to use multiple inheritance in your model class. It shouldn't be needed and I wouldn't be surprised if there were some obscure side affects. Just have interface.ItemContainer
inherit from models.Model
and then Order
inherit from only interface.ItemContainer
.