You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
26 lines
1.3 KiB
26 lines
1.3 KiB
from django.db import models
|
|
|
|
|
|
class Product(models.Model):
|
|
CATEGORY_CHOICES = [
|
|
('Food', 'Продукты'),
|
|
('Electronics', 'Электроника'),
|
|
('Clothing', 'Одежда'),
|
|
('Other', 'Другое'),
|
|
]
|
|
PROMOTION_CHOICES = [
|
|
('1+1', '1+1'),
|
|
('2+1', '2+1'),
|
|
]
|
|
name = models.CharField(max_length=255, verbose_name="Наименование товара")
|
|
barcode = models.CharField(max_length=50, unique=True, verbose_name="Штрих-код")
|
|
shelf_life_days = models.PositiveIntegerField(verbose_name="Срок годности (дни)")
|
|
dimensions = models.CharField(max_length=255, verbose_name="Размеры")
|
|
unit_of_measure = models.CharField(max_length=50, verbose_name="Единицы измерения")
|
|
manufacturer = models.CharField(max_length=255, verbose_name="Производитель")
|
|
category = models.CharField(max_length=50, choices=CATEGORY_CHOICES, verbose_name="Категория")
|
|
storage_temperature = models.CharField(max_length=50, verbose_name="Температурные условия хранения")
|
|
promotion = models.CharField(max_length=10, choices=PROMOTION_CHOICES, verbose_name="Акция", blank=True, null=True)
|
|
|
|
def __str__(self):
|
|
return self.name |