How can i add additional Data (ETIM-Featurecodes) to a existing Field [closed]
I have build a model which should representate our Products at work. Our products are different sorts of luminaires. Some of these with different variations like different colour-temperature, different housing-colour, different power, sensors or dimmable.
at the moment my model looks (a little shortend) like this
class ProductID(models.Model):
product_id = models.CharField(max_length=100, unique=True)
base_model = models.BooleanField(default=True)
active = models.BooleanField(default=True, choices=CHOICES)
possible_as_option = models.BooleanField(default=False, choices=CHOICES)
product_variant_data = models.ForeignKey('ProductVariantData', on_delete=models.PROTECT)
...
class ProductVariantData(models.Model):
short_text = models.CharField(max_length=300, null=True, blank=True)
packaging_unit = models.IntegerField(validators=[MinValueValidator(1)])
guarantee = models.IntegerField()
product = models.ForeignKey('Product', null=True, on_delete=models.PROTECT)
...
class Product(models.Model):
enec = models.BooleanField(default=False)
ce = models.BooleanField(default=True)
min_ambient_temperature = models.IntegerField()
max_ambient_temperature = models.IntegerField()
ip_code = models.ForeignKey(IPCode, on_delete=models.PROTECT)
ik_code = models.ForeignKey(IKCode, on_delete=models.PROTECT)
dimensions = models.ForeignKey(Dimensions)
cutout_dimensions = models.ForeignKey(CutoutDimensions, null=True)
product_type = models.ForeignKey(ProductType, on_delete=models.PROTECT)
....
class LEDData(models.Model):
led_changeable = models.BooleanField(default=True)
average_lifespan = models.IntegerField(null=True, blank=True)
dimmable = models.BooleanField(default=False)
voltage = models.DecimalField(max_digits=5, decimal_places=2, null=False)
flicker_metric = models.DecimalField(max_digits=2, decimal_places=1, null=True)
stroboscopic_effect_metric = models.DecimalField(max_digits=2, decimal_places=1, null=True)
class LEDData(models.Model):
average_lifespan = models.IntegerField()
dimmable = models.BooleanField(default=True)
voltage = models.DecimalField(max_digits=5, decimal_places=2, null=False)
flicker_metric = models.DecimalField(max_digits=2, decimal_places=1, null=True)
stroboscopic_effect_metric = models.DecimalField(max_digits=2, decimal_places=1, null=True)
class Luminaire(models.Model):
product = models.OneToOneField(Product, primary_key=True)
control_gear_included = models.BooleanField(default=True)
external_control_gear = models.BooleanField(default=True)
control_gear_changeable = models.BooleanField(default=True)
control_gears = models.ManyToManyField('ControlGear', through='LuminaireControlGearDetails')
led_data = models.ForeignKey(LEDData)
lighting_technology = models.CharField(max_length=15, choices=LightingTechnology, default=LightingTechnology.LED)
...
class PhotometricData(models.Model):
luminaire = models.ForeignKey(Luminaire)
lum_flux = models.IntegerField()
cri = models.IntegerField(validators=[MaxValueValidator(100), MinValueValidator(-100)])
power_details = models.ForeignKey('PowerDetails')
ldt_file = models.FileField(upload_to='data/ldt_files/', null=True)
light_curve = models.FileField(upload_to='data/light_curve/', null=True)
reference_settings = models.BooleanField(default=False)
colour_consistency = models.IntegerField(validators=[MaxValueValidator(7), MinValueValidator(1)])
colour_temperature = models.ForeignKey(ColourTemperature, on_delete=models.PROTECT,null=True, blank=True)
light_colour = models.ForeignKey()
class EmergencyLighting(models.Model):
product = models.OneToOneField(Product, primary_key=True)
....
class ControlGear(models.Model):
product = models.OneToOneField(Product, primary_key=True)
....
my "problem" now: We want to classify our product-data with the ETIM-System (for example the link for the ceiling light ) but i have no clue how i build this in my model. First i wanted a seperate class only for the properties and referentiate from every class to this class, but this "looks not right".