1
1
from django .db import models
2
2
from django .utils import timezone
3
3
from django_mysql .models import JSONField
4
+ from django .utils .translation import ugettext_lazy as _
4
5
5
6
6
7
class Statistics (models .Model ):
@@ -12,76 +13,71 @@ class Statistics(models.Model):
12
13
'wikis' , 'goodsGuides' , 'rumors'
13
14
)
14
15
15
- globalStatistics = models .TextField (default = '{}' )
16
- domesticStatistics = models .TextField (default = '{}' )
17
- internationalStatistics = models .TextField (default = '{}' )
18
- remarks = models .TextField (default = '[]' )
19
- notes = models .TextField (default = '[]' )
20
- generalRemark = models .TextField (default = '' )
21
- WHOArticle = models .TextField (verbose_name = 'WHO 文章' , default = '{}' )
22
- recommends = models .TextField (verbose_name = '防护知识' , default = '[]' )
23
- timelines = models .TextField (verbose_name = '时间线事件' , default = '[]' )
24
- wikis = models .TextField (verbose_name = 'Wiki' , default = '[]' )
25
- goodsGuides = models .TextField (verbose_name = '购物指南' , default = '[]' )
26
- rumors = models .TextField (verbose_name = '辟谣与防护' , default = '[]' )
27
- modifyTime = models .DateTimeField (null = True )
28
- createTime = models .DateTimeField (null = True )
29
- crawlTime = models .DateTimeField (
30
- "抓取时间" , default = timezone .now , editable = False )
16
+ globalStatistics = models .TextField (_ ('globalStatistics' ), default = '{}' )
17
+ domesticStatistics = models .TextField (_ ('domesticStatistics' ), default = '{}' )
18
+ internationalStatistics = models .TextField (_ ('internationalStatistics' ), default = '{}' )
19
+ remarks = models .TextField (_ ('remarks' ), default = '[]' )
20
+ notes = models .TextField (_ ('notes' ), default = '[]' )
21
+ generalRemark = models .TextField (_ ('generalRemark' ), default = '' )
22
+ WHOArticle = models .TextField (_ ('WHOArticle' ), default = '{}' )
23
+ recommends = models .TextField (_ ('recommends' ), default = '[]' )
24
+ timelines = models .TextField (_ ('timelines' ), default = '[]' )
25
+ wikis = models .TextField (_ ('Wiki' ), default = '[]' )
26
+ goodsGuides = models .TextField (_ ('goodsGuides' ), default = '[]' )
27
+ rumors = models .TextField (_ ('rumors' ), default = '[]' )
28
+ modifyTime = models .DateTimeField (_ ('modifyTime' ), null = True )
29
+ createTime = models .DateTimeField (_ ('createTime' ), null = True )
30
+ crawlTime = models .DateTimeField (_ ('crawlTime' ), default = timezone .now , editable = False )
31
31
32
32
class Meta :
33
- verbose_name = '统计数据'
34
- verbose_name_plural = '统计数据'
33
+ verbose_name = _ ( 'Statistics' )
34
+ verbose_name_plural = _ ( 'Statistics' )
35
35
36
36
37
37
class Province (models .Model ):
38
38
39
- locationId = models .IntegerField ()
40
- provinceName = models .CharField (max_length = 50 )
41
- provinceShortName = models .CharField (max_length = 20 )
42
- currentConfirmedCount = models .IntegerField (default = 0 )
43
- confirmedCount = models .IntegerField (default = 0 )
44
- suspectedCount = models .IntegerField (default = 0 )
45
- curedCount = models .IntegerField (default = 0 )
46
- deadCount = models .IntegerField (default = 0 )
47
- comment = models .CharField (max_length = 200 )
48
- statisticsData = models .CharField (max_length = 500 )
49
- dailyData = models .TextField ()
50
- created = models .DateTimeField (
51
- '创建时间' , auto_now_add = True , editable = False )
52
- updated = models .DateTimeField (
53
- '更新时间' , auto_now = True , editable = False )
39
+ locationId = models .IntegerField (_ ('locationId' ))
40
+ provinceName = models .CharField (_ ('provinceName' ), max_length = 50 )
41
+ provinceShortName = models .CharField (_ ('provinceShortName' ), max_length = 20 )
42
+ currentConfirmedCount = models .IntegerField (_ ('currentConfirmedCount' ), default = 0 )
43
+ confirmedCount = models .IntegerField (_ ('confirmedCount' ), default = 0 )
44
+ suspectedCount = models .IntegerField (_ ('suspectedCount' ), default = 0 )
45
+ curedCount = models .IntegerField (_ ('curedCount' ), default = 0 )
46
+ deadCount = models .IntegerField (_ ('deadCount' ), default = 0 )
47
+ comment = models .CharField (_ ('comment' ), max_length = 200 )
48
+ statisticsData = models .CharField (_ ('statisticsData' ), max_length = 500 )
49
+ dailyData = models .TextField (_ ('dailyData' ))
50
+ createTime = models .DateTimeField (_ ('createTime' ), auto_now_add = True , editable = False )
51
+ modifyTime = models .DateTimeField (_ ('modifyTime' ), auto_now = True , editable = False )
54
52
55
53
class Meta :
56
- verbose_name = '国内省份'
57
- verbose_name_plural = '国内省份'
54
+ verbose_name = _ ( 'Province' )
55
+ verbose_name_plural = _ ( 'Province' )
58
56
59
57
60
58
class City (models .Model ):
61
59
62
- locationId = models .IntegerField ()
63
- cityName = models .CharField (max_length = 50 )
64
- currentConfirmedCount = models .IntegerField (default = 0 )
65
- confirmedCount = models .IntegerField (default = 0 )
66
- suspectedCount = models .IntegerField (default = 0 )
67
- curedCount = models .IntegerField (default = 0 )
68
- deadCount = models .IntegerField (default = 0 )
69
- created = models .DateTimeField (
70
- '创建时间' , auto_now_add = True , editable = False )
71
- updated = models .DateTimeField (
72
- '更新时间' , auto_now = True , editable = False )
60
+ locationId = models .IntegerField (_ ('locationId' ))
61
+ cityName = models .CharField (_ ('cityName' ), max_length = 50 )
62
+ currentConfirmedCount = models .IntegerField (_ ('currentConfirmedCount' ), default = 0 )
63
+ confirmedCount = models .IntegerField (_ ('confirmedCount' ), default = 0 )
64
+ suspectedCount = models .IntegerField (_ ('suspectedCount' ), default = 0 )
65
+ curedCount = models .IntegerField (_ ('curedCount' ), default = 0 )
66
+ deadCount = models .IntegerField (_ ('deadCount' ), default = 0 )
67
+ createTime = models .DateTimeField (_ ('createTime' ), auto_now_add = True , editable = False )
68
+ modifyTime = models .DateTimeField (_ ('modifyTime' ), auto_now = True , editable = False )
73
69
province = models .ForeignKey (
74
- "Province" , on_delete = models .CASCADE , related_name = "cities" ,
75
- db_column = "provinceId"
70
+ "Province" , verbose_name = _ ( 'province' ), on_delete = models .CASCADE ,
71
+ related_name = "cities" , db_column = "provinceId"
76
72
)
77
73
78
74
@property
79
75
def provinceName (self ):
80
76
return self .province .provinceName
81
77
82
78
class Meta :
83
- verbose_name = "国内城市"
84
- verbose_name_plural = "国内城市"
79
+ verbose_name = _ ( 'City' )
80
+ verbose_name_plural = _ ( 'City' )
85
81
86
82
87
83
class Country (models .Model ):
@@ -109,11 +105,9 @@ class Country(models.Model):
109
105
sort = models .IntegerField (null = True )
110
106
operator = models .CharField (max_length = 50 , null = True )
111
107
dailyData = models .TextField ()
112
- created = models .DateTimeField (
113
- '创建时间' , auto_now_add = True , editable = False )
114
- updated = models .DateTimeField (
115
- '更新时间' , auto_now = True , editable = False )
108
+ createTime = models .DateTimeField (_ ('createTime' ), auto_now_add = True , editable = False )
109
+ modifyTime = models .DateTimeField (_ ('modifyTime' ), auto_now = True , editable = False )
116
110
117
111
class Meta :
118
- verbose_name = "国家地区"
119
- verbose_name_plural = "国家地区"
112
+ verbose_name = _ ( 'Country' )
113
+ verbose_name_plural = _ ( 'Country' )
0 commit comments