Here's the deal:
I have two db models, say ShoppingCart and Order . Following the DRY principle, I would like to extract some common details / methods into the general ItemContainer interface.
Everything went fine until I came across the _flush() method, which basically does the deletion of the related object.
class Order(models.Model, interface.ItemContainer): # ... def _flush(self): # ... self.orderitem_set.all().delete()
So the question is: how can I dynamically find out if this is orderitem_set or shoppingcartitem_set ?
source share