from django.db import models from django.utils.translation import gettext_lazy from ncircc.models.notification import Notification class Comment(models.Model): """Comment notification from NCIRCC.""" text = models.TextField(gettext_lazy('Comment text')) create_time = models.DateTimeField(gettext_lazy('Create time')) login = models.CharField(gettext_lazy('login'), max_length=127, blank=True) notification = models.ForeignKey(Notification, verbose_name=gettext_lazy('Notification incident'), on_delete=models.CASCADE) id_in_ncircc = models.PositiveIntegerField('In it to NCIRCC', unique=True) is_read = models.BooleanField('Is was read', default=False) from_console = models.BooleanField('This is message from console?', default=False) class Meta: verbose_name = gettext_lazy('Comment') verbose_name_plural = gettext_lazy('Comments') ordering = ('-create_time',) def __str__(self) -> str: return f'{self.notification}: {self.text}'