***class Product(models.Model):
product_id = models.IntegerField(primary_key=True)
name = models.TextField()
length = models.FloatField()
width = models.FloatField()
depth = models.FloatField()
color_text = models.TextField()
color_rgb = models.ForeignKey(ColorRGB, on_delete=models.SET_NULL, null=True)
color_cmyk = models.ForeignKey(ColorCMYK, on_delete=models.SET_NULL, null=True)
treatment_text = models.TextField()
treatment_number = models.FloatField()
transparency_text = models.TextField()
transparency_number = models.FloatField()
total_carat_weight = models.FloatField()
country_of_origin = models.TextField()
hardness_text = models.TextField()
hardness_number = models.FloatField()
pieces_text = models.TextField(
pieces_number = models.IntegerField()
price_pkr = models.FloatField()***
см. Поля color_rgb и color_cmyk. Один имеет 3 целочисленных значения для хранения, а другой имеет 4 целочисленных значения для хранения.
Я пытаюсь определить это как ниже. Вопрос в том, что это правильный путь или есть лучший способ сделать это?
class ColorRGB(models.Model):
R = models.IntegerField()
G = models.IntegerField()
B = models.IntegerField()