liquid/web/streaming/models.py
2025-06-03 13:14:25 +07:00

41 lines
1.4 KiB
Python
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

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 'Запрещён'})"
class DetectionHistory(models.Model):
STATUS_CHOICES = [
('good', 'Норма'),
('bad', 'Не норма'),
]
timestamp = models.DateTimeField(auto_now_add=True, verbose_name='Дата и время')
status = models.CharField(max_length=4, choices=STATUS_CHOICES, verbose_name='Статус')
class Meta:
ordering = ['-timestamp']
verbose_name = 'Запись истории'
verbose_name_plural = 'История обнаружений'
def __str__(self):
return f"{self.get_status_display()} — {self.timestamp:%Y-%m-%d %H:%M:%S}"