
from django.db import models
from apps.tenant.option.models import Option
from apps.tenant.building.models import Building

class Equipment(models.Model):
    name = models.CharField(verbose_name=u'设备名称', max_length=100)
    quality_date = models.DateField(verbose_name=u'质保到期', null=True)
    location = models.ForeignKey(Building, verbose_name=u'设备位置', on_delete=models.PROTECT, null=True)
    type = models.ForeignKey(Option, verbose_name=u'设备分类', on_delete=models.PROTECT, null=True, related_name='type_option')
    supplier = models.ForeignKey(Option, verbose_name=u'设备供应商', on_delete=models.PROTECT, null=True, related_name='supplier_option')

    class Meta:
        db_table = 'equipment'
        verbose_name = u'设备信息'
        ordering = ['-id', ]
        default_permissions = ()
        permissions = [
            ('browse_equipment', u'查看'),
            ('add_equipment', u'添加'),
            ('delete_equipment', u'删除')
        ]
