|
# -*- coding: utf-8 -*-
from django.db import models
from django.utils.translation import gettext_lazy as _
from django_models_ext import BaseModelMixin
from shortuuidfield import ShortUUIDField
class ThermometerInfo(BaseModelMixin):
thermometer_id = ShortUUIDField(_('thermometer_id'), max_length=32, blank=True, null=True, help_text='体温计唯一标识', db_index=True, unique=True)
user_id = models.CharField(_('user_id'), max_length=32, blank=True, help_text='用户唯一标识', db_index=True)
macid = models.CharField(_('macid'), max_length=32, blank=True, null=True, help_text='设备号')
class Meta:
verbose_name = _('体温计信息')
verbose_name_plural = _('体温计信息')
def __unicode__(self):
return self.pk
@property
def data(self):
return {
'thermometer_id': self.thermometer_id,
'user_id': self.user_id,
'macid': self.macid,
}
|