How to model this in django:
1) have a base network of manufacturers
2) under each network their might be several distributors
3) a user of the system can access items through the distributor
4) if a user access the item through the distributor we want that item to be translated where each manufacturer will have their own translation
class Manufacturer(models.Model):
networkname = models.CharField(max_length=128)
class Meta:
proxy = True
class Distributor(models.Model):
man = models.ForeignKey(Manufacturer)
class ManuType1(Manufacturer):
def translate(self, str):
return 'translate'
class ManuType2(Manufacturer):
def translate(self, str):
return 'translate'
In this scenario we will get a request for a certain Distributor. We identify that distributor and we want to call that distributors manufacturers translate method. Does this look like a way to model this in django (I'm sure there are many ways to do this) so any input/feedback is useful.
Where I run into problems (not knowing python well enough perhaps) is given a Distributor with ManuType1 How do I call the translate function at runtime?
This is probably a well explored pattern using other terms, just not sure how to express it exactly.