24 lines
859 B
Python
24 lines
859 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)
|
|
|
|
name = models.CharField(max_length=50, unique=True, help_text="введите цвет")
|
|
allowed = models.BooleanField(default=True)
|
|
|
|
def __str__(self):
|
|
return f"{self.name} ({'Разрешён' if self.allowed else 'Запрещён'})" |