class="add-code nl-23 ol-23">
+ ('temperature', models.FloatField(default=0, help_text='用户体温', verbose_name='temperature')),
+ ],
+ options={
+ 'verbose_name': '体温信息',
+ 'verbose_name_plural': '体温信息',
+ },
+ ),
+ migrations.DeleteModel(
+ name='ThermometerInfo',
+ ),
+ ]
@@ -0,0 +1,28 @@ |
||
| 1 |
+# -*- coding: utf-8 -*- |
|
| 2 |
+ |
|
| 3 |
+from django.db import models |
|
| 4 |
+from django.utils.translation import gettext_lazy as _ |
|
| 5 |
+from django_models_ext import BaseModelMixin |
|
| 6 |
+ |
|
| 7 |
+ |
|
| 8 |
+class TemperatureInfo(BaseModelMixin): |
|
| 9 |
+ thermometer_id = models.CharField(_('thermometer_id'), max_length=32, blank=True, help_text='体温计唯一标识', db_index=True)
|
|
| 10 |
+ user_id = models.CharField(_('user_id'), max_length=32, blank=True, help_text='用户唯一标识', db_index=True)
|
|
| 11 |
+ macid = models.CharField(_('macid'), max_length=32, blank=True, null=True, help_text='设备号')
|
|
| 12 |
+ temperature = models.FloatField(_('temperature'), default=0, help_text='用户体温')
|
|
| 13 |
+ |
|
| 14 |
+ class Meta: |
|
| 15 |
+ verbose_name = _('体温信息')
|
|
| 16 |
+ verbose_name_plural = _('体温信息')
|
|
| 17 |
+ |
|
| 18 |
+ def __unicode__(self): |
|
| 19 |
+ return self.pk |
|
| 20 |
+ |
|
| 21 |
+ @property |
|
| 22 |
+ def data(self): |
|
| 23 |
+ return {
|
|
| 24 |
+ 'thermometer_id': self.thermometer_id, |
|
| 25 |
+ 'user_id': self.user_id, |
|
| 26 |
+ 'macid': self.macid, |
|
| 27 |
+ 'temperature': self.temperature, |
|
| 28 |
+ } |
@@ -0,0 +1,4 @@ |
||
| 1 |
+from django.test import TestCase |
|
| 2 |
+ |
|
| 3 |
+ |
|
| 4 |
+# Create your tests here. |
@@ -0,0 +1,4 @@ |
||
| 1 |
+from django.shortcuts import render |
|
| 2 |
+ |
|
| 3 |
+ |
|
| 4 |
+# Create your views here. |
@@ -2,7 +2,7 @@ |
||
| 2 | 2 |
|
| 3 | 3 |
from django.db import models |
| 4 | 4 |
from django.utils.translation import gettext_lazy as _ |
| 5 |
-from django_models_ext import BaseModelMixin, SexModelMixin |
|
| 5 |
+from django_models_ext import BaseModelMixin |
|
| 6 | 6 |
from shortuuidfield import ShortUUIDField |
| 7 | 7 |
|
| 8 | 8 |
|
@@ -58,6 +58,7 @@ INSTALLED_APPS = [ |
||
| 58 | 58 |
'api', |
| 59 | 59 |
'account', |
| 60 | 60 |
'thermometer', |
| 61 |
+ 'temperature', |
|
| 61 | 62 |
] |
| 62 | 63 |
|
| 63 | 64 |
MIDDLEWARE = [ |