class="add-code nl-23 ol-23"> 23
+                ('temperature', models.FloatField(default=0, help_text='用户体温', verbose_name='temperature')),
24
+            ],
25
+            options={
26
+                'verbose_name': '体温信息',
27
+                'verbose_name_plural': '体温信息',
28
+            },
29
+        ),
30
+        migrations.DeleteModel(
31
+            name='ThermometerInfo',
32
+        ),
33
+    ]

+ 0 - 0
temperature/migrations/__init__.py


+ 28 - 0
temperature/models.py

@@ -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
+        }

+ 4 - 0
temperature/tests.py

@@ -0,0 +1,4 @@
1
+from django.test import TestCase
2
+
3
+
4
+# Create your tests here.

+ 4 - 0
temperature/views.py

@@ -0,0 +1,4 @@
1
+from django.shortcuts import render
2
+
3
+
4
+# Create your views here.

+ 1 - 1
thermometer/models.py

@@ -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
 

+ 1 - 0
tiwen/settings.py

@@ -58,6 +58,7 @@ INSTALLED_APPS = [
58 58
     'api',
59 59
     'account',
60 60
     'thermometer',
61
+    'temperature',
61 62
 ]
62 63
 
63 64
 MIDDLEWARE = [

kodo - Gogs: Go Git Service

暂无描述

Brightcells: a078341431 Preauth page 7 年之前
..
basic.html a078341431 Preauth page 7 年之前
basic_pc.html a078341431 Preauth page 7 年之前
basic_pure.html a078341431 Preauth page 7 年之前