Let's say I have Cars, CarTypes, and their BuildDates like this:
class Car(db.models):
licence_name = models.CharField(max_length=64)
car_type = models.ForeignKey(Type)
class Type(db.models):
name = models.CharField(max_length=64)
build_during = models.ForeignKey(BuildDate)
class BuildDate(db.models):
begin = models.DateField(null=True)
end = models.DateField(null=True)
class Meta(object):
unique_together = (('begin', 'end'),)
I want to have the BuildDates in a seperate table such I can do faster queries and other stuff with Django-external tools.
Since BuildDates are unique but shared between CarTypes, I want to make sure this: If the BuildDate d0 of one CarType t1 is changed, the other CarTypes are not affected and they still share the identical BuildDate d0 – but not with t1 which now has d1. I believe it is necessary to create a new BuildDate d1 for that CarType t1. Is there a recommended or recommendable way to do this?