from django.db import models
from apps.system.models import CommonBModel,CommonAModel,Dict
from simple_history.models import HistoricalRecords
from django.contrib.postgres.fields import ArrayField
import uuid
# Create your models here.
class TestOrg(CommonBModel):
   
    code = models.CharField('实验室编号', max_length=100)
    name = models.CharField('实验室名称',null=True, blank=True,max_length=200)
    address =  models.CharField('通讯地址',null=True, blank=True,max_length=500)
    contactman = models.CharField('联系人',null=True, blank=True,max_length=50)
    contactmanmoblie =  models.CharField('联系人手机',null=True, blank=True,max_length=50)
    contactManTel =  models.CharField('联系人电话',null=True, blank=True,max_length=50)
    loginname = models.CharField('登录名',null=True, blank=True,max_length=50)
    password = models.CharField('登录密码',null=True, blank=True,max_length=50)
    note = models.CharField('备注',null=True, blank=True,max_length=200)
    iszy = models.BooleanField('是否自有', default=True)
    class Meta:
        verbose_name = '实验室信息'
        verbose_name_plural = verbose_name

    def __str__(self):
        return self.name
class TestOrgNotice(CommonBModel):

    name = models.CharField('公告标题',null=True, blank=True,max_length=500)
    publishdate =  models.DateTimeField('发布时间')
    ismportant = models.BooleanField('是否重要公告', default=True)
    note = models.CharField('公告内容',null=True, blank=True,max_length=6000)
    isalluser = models.BooleanField('是否通知全员', default=True)
    path = models.CharField('文件地址', max_length=1000, null=True, blank=True)
    dettonotice = models.ManyToManyField(TestOrg, blank=True, verbose_name='选择的实验室', related_name= 'testorgnotice_dettonotice')
    class Meta:
        verbose_name = '实验室通知公告'
        verbose_name_plural = verbose_name

    def __str__(self):
        return self.name

