Geen omschrijving

models.py 1.1KB

    # -*- 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 from TimeConvert import TimeConvert as tc 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='设备号') bound_at = models.DateTimeField(_('bound_at'), 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, 'bound_at': tc.local_string(utc_dt=self.bound_at), }