21 lines
691 B
Python
21 lines
691 B
Python
from django.db import models
|
|
|
|
# Create your models here.
|
|
class AllowedColor(models.Model):
|
|
COLOR_CHOICES = [
|
|
('red', 'Красный'),
|
|
('green', 'Зелёный'),
|
|
('blue', 'Синий'),
|
|
('yellow', 'Жёлтый'),
|
|
('orange', 'Оранжевый'),
|
|
('black', 'Чёрный'),
|
|
('white', 'Белый'),
|
|
('woter', 'Вода'),
|
|
# добавь нужные цвета
|
|
]
|
|
|
|
name = models.CharField(max_length=50, choices=COLOR_CHOICES, unique=True)
|
|
allowed = models.BooleanField(default=True)
|
|
|
|
def __str__(self):
|
|
return f"{self.name} ({'Разрешён' if self.allowed else 'Запрещён'})" |