Your derived classes are models, and they should be models. What they
shouldn't be is have different tables for each model type, there
should be one table that all instances are stored in to, as the data
for each Calculation instance, regardless of type, is the same.
This is a common idiom in ORMs, and is called Single Table Inheritance:
http://www.martinfowler.com/eaaCatalog/singleTableInheritance.html
Django doesn't support STI, but that doesn't really matter, you can
get the same behaviour by using composition rather than inheritance,
something like this:
CALC_TYPE_MAP = {
'trailer': TrailerCalculation,
'truck': TruckCalculation,
}
class Calculation(models.Model):
.....
#
def calculate(self):
calculator = CALC_TYPE_MAP[self.calculation_type]()
calculator.calculate(self)
TrailerCalculation and TruckCalculation do not derive from
Calculation, they are simply objects that provide functionality to
Calculation. This approach is called "Composition over inheritance".
Cheers
Tom