# coding=utf-8


from django.db import models
from django.conf import settings

from apps.tenant.models import Tenant


class Notices(models.Model):
    content = models.CharField(max_length=200, verbose_name=u"内容")
    title = models.CharField(max_length=50, verbose_name=u'标题')
    create_time = models.DateTimeField(verbose_name='发布时间', auto_now_add=True)
    create_user = models.ForeignKey(settings.AUTH_USER_MODEL, verbose_name=u"创建者", on_delete=models.PROTECT,
                                    editable=False)
    tenant = models.ForeignKey(Tenant, verbose_name=u'租户', on_delete=models.PROTECT, blank=True)

    class Meta:
        db_table = "notices"
        verbose_name = u"通知"
        ordering = ['-id']
        default_permissions = ()
        permissions = [
            ('browse_notices', u'查看'),
            ('add_notices', u'添加'),
            ('delete_notices', u'删除'),
        ]
