CreateUpdateMixin => BaseModelMixin

Brightcells 7 gadi atpakaļ
vecāks
revīzija
d28dca92ff
7 mainītis faili ar 39 papildinājumiem un 44 dzēšanām
  1. 10 9
      account/models.py
  2. 8 7
      group/models.py
  3. 6 5
      message/models.py
  4. 9 8
      operation/models.py
  5. 0 9
      pai2/basemodels.py
  6. 2 2
      pay/models.py
  7. 4 4
      photo/models.py

+ 10 - 9
account/models.py

@@ -3,11 +3,12 @@
3 3
 from django.db import models
4 4
 from django.utils.translation import ugettext_lazy as _
5 5
 from jsonfield import JSONField
6
+from models_ext import BaseModelMixin
6 7
 
7
-from pai2.basemodels import CreateUpdateMixin, LensmanTypeBoolMixin, LensmanTypeMixin
8
+from pai2.basemodels import LensmanTypeBoolMixin, LensmanTypeMixin
8 9
 
9 10
 
10
-class LensmanInfo(CreateUpdateMixin, LensmanTypeBoolMixin):
11
+class LensmanInfo(BaseModelMixin, LensmanTypeBoolMixin):
11 12
     MALE = 1
12 13
     FEMALE = 0
13 14
 
@@ -94,7 +95,7 @@ class LensmanInfo(CreateUpdateMixin, LensmanTypeBoolMixin):
94 95
         return False
95 96
 
96 97
 
97
-class LensmanLoginLogInfo(CreateUpdateMixin):
98
+class LensmanLoginLogInfo(BaseModelMixin):
98 99
     SUCCESS = 0
99 100
     PWD_ERROR = 1
100 101
     OTHER = 2
@@ -117,7 +118,7 @@ class LensmanLoginLogInfo(CreateUpdateMixin):
117 118
         return unicode(self.pk)
118 119
 
119 120
 
120
-class LensmanIncomeExpensesInfo(CreateUpdateMixin):
121
+class LensmanIncomeExpensesInfo(BaseModelMixin):
121 122
     INCOME = 0
122 123
     EXPENSE = 1
123 124
     UNFREEZE = 2
@@ -149,7 +150,7 @@ class LensmanIncomeExpensesInfo(CreateUpdateMixin):
149 150
         return unicode(self.pk)
150 151
 
151 152
 
152
-class TourGuideInfo(CreateUpdateMixin):
153
+class TourGuideInfo(BaseModelMixin):
153 154
     MALE = 1
154 155
     FEMALE = 0
155 156
 
@@ -217,7 +218,7 @@ class TourGuideInfo(CreateUpdateMixin):
217 218
         return self.user_status in [self.UNVERIFIED, self.REFUSED]
218 219
 
219 220
 
220
-class WechatInfo(CreateUpdateMixin):
221
+class WechatInfo(BaseModelMixin):
221 222
     MALE = 1
222 223
     FEMALE = 0
223 224
 
@@ -244,7 +245,7 @@ class WechatInfo(CreateUpdateMixin):
244 245
         return unicode(self.pk)
245 246
 
246 247
 
247
-class UserInfo(CreateUpdateMixin, LensmanTypeBoolMixin):
248
+class UserInfo(BaseModelMixin, LensmanTypeBoolMixin):
248 249
     APP_USER = 0
249 250
     WX_USER = 1
250 251
     USER_USER = 8
@@ -366,7 +367,7 @@ class UserInfo(CreateUpdateMixin, LensmanTypeBoolMixin):
366 367
         }
367 368
 
368 369
 
369
-class UserLoginLogInfo(CreateUpdateMixin):
370
+class UserLoginLogInfo(BaseModelMixin):
370 371
     SUCCESS = 0
371 372
     PWD_ERROR = 1
372 373
     OTHER = 2
@@ -389,7 +390,7 @@ class UserLoginLogInfo(CreateUpdateMixin):
389 390
         return unicode(self.pk)
390 391
 
391 392
 
392
-class UserIncomeExpensesInfo(CreateUpdateMixin):
393
+class UserIncomeExpensesInfo(BaseModelMixin):
393 394
     INCOME = 0
394 395
     EXPENSE = 1
395 396
     UNFREEZE = 2

+ 8 - 7
group/models.py

@@ -2,10 +2,11 @@
2 2
 
3 3
 from django.db import models
4 4
 from django.utils.translation import ugettext_lazy as _
5
+from models_ext import BaseModelMixin
5 6
 from shortuuidfield import ShortUUIDField
6 7
 from TimeConvert import TimeConvert as tc
7 8
 
8
-from pai2.basemodels import CreateUpdateMixin, LensmanTypeMixin
9
+from pai2.basemodels import LensmanTypeMixin
9 10
 from photo.models import PhotosInfo
10 11
 from utils.qiniucdn import qiniu_file_url
11 12
 from utils.redis.rgroup import get_group_photo_thumbup_flag
@@ -14,7 +15,7 @@ from utils.time_utils import origin_expired_stamps
14 15
 from utils.url_utils import share_url
15 16
 
16 17
 
17
-class GroupInfo(CreateUpdateMixin):
18
+class GroupInfo(BaseModelMixin):
18 19
     APP_GROUP = 0
19 20
     SESSION_GROUP = 1
20 21
     TOURGUIDE_GROUP = 10
@@ -135,7 +136,7 @@ class GroupInfo(CreateUpdateMixin):
135 136
         }
136 137
 
137 138
 
138
-class GroupUserInfo(CreateUpdateMixin):
139
+class GroupUserInfo(BaseModelMixin):
139 140
     APPLYING = 0
140 141
     PASSED = 1
141 142
     REFUSED = 2
@@ -211,7 +212,7 @@ class GroupUserInfo(CreateUpdateMixin):
211 212
         }
212 213
 
213 214
 
214
-class GroupPhotoInfo(CreateUpdateMixin, LensmanTypeMixin):
215
+class GroupPhotoInfo(BaseModelMixin, LensmanTypeMixin):
215 216
     APP_GROUP = 0
216 217
     SESSION_GROUP = 1
217 218
 
@@ -330,7 +331,7 @@ class GroupPhotoInfo(CreateUpdateMixin, LensmanTypeMixin):
330 331
         }
331 332
 
332 333
 
333
-class GroupPhotoOrderInfo(CreateUpdateMixin):
334
+class GroupPhotoOrderInfo(BaseModelMixin):
334 335
     group_id = models.CharField(_(u'group_id'), max_length=32, blank=True, null=True, help_text=u'群组唯一标识', db_index=True)
335 336
     session_id = models.CharField(_(u'session_id'), max_length=32, blank=True, null=True, help_text=u'照片组唯一标识,同 PhotosInfo 表', db_index=True)
336 337
     user_id = models.CharField(_(u'user_id'), max_length=32, blank=True, null=True, help_text=u'用户唯一标识', db_index=True)
@@ -371,7 +372,7 @@ class GroupPhotoOrderInfo(CreateUpdateMixin):
371 372
         }
372 373
 
373 374
 
374
-class PhotoCommentInfo(CreateUpdateMixin):
375
+class PhotoCommentInfo(BaseModelMixin):
375 376
     photo_id = models.CharField(_(u'photo_id'), max_length=255, blank=True, null=True, help_text=u'飞图唯一标识', db_index=True)
376 377
     user_id = models.CharField(_(u'user_id'), max_length=255, blank=True, null=True, help_text=u'用户唯一标识', db_index=True)
377 378
     nickname = models.CharField(_(u'nickname'), max_length=255, blank=True, null=True, help_text=u'用户群组昵称')
@@ -398,7 +399,7 @@ class PhotoCommentInfo(CreateUpdateMixin):
398 399
         }
399 400
 
400 401
 
401
-class PhotoThumbUpInfo(CreateUpdateMixin):
402
+class PhotoThumbUpInfo(BaseModelMixin):
402 403
     photo_id = models.CharField(_(u'photo_id'), max_length=255, blank=True, null=True, help_text=u'飞图唯一标识', db_index=True)
403 404
     user_id = models.CharField(_(u'user_id'), max_length=255, blank=True, null=True, help_text=u'用户唯一标识', db_index=True)
404 405
     nickname = models.CharField(_(u'nickname'), max_length=255, blank=True, null=True, help_text=u'用户群组昵称')

+ 6 - 5
message/models.py

@@ -3,13 +3,14 @@
3 3
 from django.conf import settings
4 4
 from django.db import models
5 5
 from django.utils.translation import ugettext_lazy as _
6
+from models_ext import BaseModelMixin
6 7
 from TimeConvert import TimeConvert as tc
7 8
 
8 9
 from group.models import GroupPhotoInfo
9
-from pai2.basemodels import CreateUpdateMixin, PaiaiSrcMixin
10
+from pai2.basemodels import PaiaiSrcMixin
10 11
 
11 12
 
12
-class UserMessageInfo(CreateUpdateMixin):
13
+class UserMessageInfo(BaseModelMixin):
13 14
     SYSTEM = 'system'
14 15
     COMMENT = 'comment'
15 16
     THUMBUP = 'thumbup'
@@ -77,7 +78,7 @@ class UserMessageInfo(CreateUpdateMixin):
77 78
         }
78 79
 
79 80
 
80
-class SystemMessageInfo(CreateUpdateMixin, PaiaiSrcMixin):
81
+class SystemMessageInfo(BaseModelMixin, PaiaiSrcMixin):
81 82
     title = models.CharField(_(u'title'), max_length=255, help_text=u'系统消息标题')
82 83
     content = models.TextField(_(u'content'), blank=True, null=True, help_text=u'系统消息内容')
83 84
     url = models.CharField(_(u'url'), max_length=255, blank=True, null=True, help_text=u'系统消息链接')
@@ -99,7 +100,7 @@ class SystemMessageInfo(CreateUpdateMixin, PaiaiSrcMixin):
99 100
         }
100 101
 
101 102
 
102
-class SystemMessageReadInfo(CreateUpdateMixin):
103
+class SystemMessageReadInfo(BaseModelMixin):
103 104
     user_id = models.CharField(_(u'user_id'), max_length=255, blank=True, null=True, help_text=u'用户唯一标识', db_index=True)
104 105
     msg_id = models.CharField(_(u'msg_id'), max_length=255, blank=True, null=True, help_text=u'系统消息唯一标识', db_index=True)
105 106
 
@@ -113,7 +114,7 @@ class SystemMessageReadInfo(CreateUpdateMixin):
113 114
         return unicode(self.pk)
114 115
 
115 116
 
116
-class SystemMessageDeleteInfo(CreateUpdateMixin):
117
+class SystemMessageDeleteInfo(BaseModelMixin):
117 118
     user_id = models.CharField(_(u'user_id'), max_length=255, blank=True, null=True, help_text=u'用户唯一标识', db_index=True)
118 119
     msg_id = models.CharField(_(u'msg_id'), max_length=255, blank=True, null=True, help_text=u'系统消息唯一标识', db_index=True)
119 120
 

+ 9 - 8
operation/models.py

@@ -4,9 +4,10 @@ import os
4 4
 
5 5
 from django.db import models
6 6
 from django.utils.translation import ugettext_lazy as _
7
+from models_ext import BaseModelMixin
7 8
 from TimeConvert import TimeConvert as tc
8 9
 
9
-from pai2.basemodels import CreateUpdateMixin, PaiaiSrcMixin, PlatformMixin, VersionMixin
10
+from pai2.basemodels import PaiaiSrcMixin, PlatformMixin, VersionMixin
10 11
 from utils.url_utils import upload_file_url
11 12
 
12 13
 
@@ -18,7 +19,7 @@ def upload_path(instance, old_filename):
18 19
     )
19 20
 
20 21
 
21
-class LatestAppInfo(CreateUpdateMixin, PaiaiSrcMixin):
22
+class LatestAppInfo(BaseModelMixin, PaiaiSrcMixin):
22 23
     latest_adr_version_code = models.IntegerField(_(u'latest_adr_version_code'), default=0, help_text=u'最新安卓版本号')
23 24
     latest_adr_version_name = models.CharField(_(u'latest_adr_version_name'), max_length=255, blank=True, null=True, help_text=u'最新安卓版本名')
24 25
     latest_adr_app = models.FileField(_(u'latest_adr_app'), upload_to=upload_path, blank=True, null=True, help_text=u'最新版安卓 APP')
@@ -51,7 +52,7 @@ class LatestAppInfo(CreateUpdateMixin, PaiaiSrcMixin):
51 52
         }
52 53
 
53 54
 
54
-class PatchInfo(CreateUpdateMixin, PlatformMixin, PaiaiSrcMixin):
55
+class PatchInfo(BaseModelMixin, PlatformMixin, PaiaiSrcMixin):
55 56
     version = models.CharField(_(u'version'), max_length=255, blank=True, null=True, help_text=u'版本(1.0.0)')
56 57
     patch = models.FileField(_(u'patch'), upload_to=upload_path, blank=True, null=True, help_text=u'补丁')
57 58
 
@@ -73,7 +74,7 @@ class PatchInfo(CreateUpdateMixin, PlatformMixin, PaiaiSrcMixin):
73 74
         }
74 75
 
75 76
 
76
-class APPSettingsInfo(CreateUpdateMixin, PlatformMixin, PaiaiSrcMixin):
77
+class APPSettingsInfo(BaseModelMixin, PlatformMixin, PaiaiSrcMixin):
77 78
     channel = models.CharField(_(u'channel'), max_length=255, blank=True, null=True, help_text=u'渠道')
78 79
     version = models.CharField(_(u'version'), max_length=255, blank=True, null=True, help_text=u'版本(1.0.0)')
79 80
 
@@ -93,7 +94,7 @@ class APPSettingsInfo(CreateUpdateMixin, PlatformMixin, PaiaiSrcMixin):
93 94
         }
94 95
 
95 96
 
96
-class SplashInfo(CreateUpdateMixin, PaiaiSrcMixin):
97
+class SplashInfo(BaseModelMixin, PaiaiSrcMixin):
97 98
     splash_image = models.ImageField(_(u'splash_image'), upload_to=upload_path, blank=True, null=True, help_text=u'启动页面图片')
98 99
     spalash_image_airtime = models.DateTimeField(_(u'spalash_image_airtime'), blank=True, null=True, help_text=u'启动页面图片开始日期')
99 100
     spalash_image_deadline = models.DateTimeField(_(u'spalash_image_deadline'), blank=True, null=True, help_text=u'启动页面图片截止日期')
@@ -118,7 +119,7 @@ class SplashInfo(CreateUpdateMixin, PaiaiSrcMixin):
118 119
         }
119 120
 
120 121
 
121
-class FeedbackInfo(CreateUpdateMixin, PaiaiSrcMixin):
122
+class FeedbackInfo(BaseModelMixin, PaiaiSrcMixin):
122 123
     user_id = models.CharField(_(u'user_id'), max_length=255, blank=True, null=True, help_text=u'用户唯一标识')
123 124
     feedback = models.TextField(_(u'feedback'), blank=True, null=True, help_text=u'用户反馈')
124 125
 
@@ -130,7 +131,7 @@ class FeedbackInfo(CreateUpdateMixin, PaiaiSrcMixin):
130 131
         return u'{0.pk}'.format(self)
131 132
 
132 133
 
133
-class GuestEntranceControlInfo(CreateUpdateMixin, PlatformMixin, VersionMixin, PaiaiSrcMixin):
134
+class GuestEntranceControlInfo(BaseModelMixin, PlatformMixin, VersionMixin, PaiaiSrcMixin):
134 135
 
135 136
     class Meta:
136 137
         verbose_name = _('guestentrancecontrolinfo')
@@ -150,7 +151,7 @@ class GuestEntranceControlInfo(CreateUpdateMixin, PlatformMixin, VersionMixin, P
150 151
         }
151 152
 
152 153
 
153
-class BoxProgramVersionInfo(CreateUpdateMixin):
154
+class BoxProgramVersionInfo(BaseModelMixin):
154 155
     srv_version_code = models.IntegerField(_(u'srv_version_code'), default=0, help_text=u'Box Server 版本号')
155 156
     srv_version_name = models.CharField(_(u'srv_version_name'), max_length=255, blank=True, null=True, help_text=u'Box Server 版本名')
156 157
     srv_sha1 = models.CharField(_(u'srv_sha1'), max_length=255, blank=True, null=True, help_text=u'Box Server Commit SHA1')

+ 0 - 9
pai2/basemodels.py

@@ -6,15 +6,6 @@ from django.utils.translation import ugettext_lazy as _
6 6
 from utils.version_utils import is_version_match
7 7
 
8 8
 
9
-class CreateUpdateMixin(models.Model):
10
-    status = models.BooleanField(_(u'status'), default=True, help_text=_(u'状态'), db_index=True)
11
-    created_at = models.DateTimeField(_(u'created_at'), auto_now_add=True, editable=True, help_text=_(u'创建时间'))
12
-    updated_at = models.DateTimeField(_(u'updated_at'), auto_now=True, editable=True, help_text=_(u'更新时间'))
13
-
14
-    class Meta:
15
-        abstract = True
16
-
17
-
18 9
 class PlatformMixin(models.Model):
19 10
     BOTH = 0
20 11
     ADR = 1

+ 2 - 2
pay/models.py

@@ -2,14 +2,14 @@
2 2
 
3 3
 from django.db import models
4 4
 from django.utils.translation import ugettext_lazy as _
5
+from models_ext import BaseModelMixin
5 6
 from shortuuidfield import ShortUUIDField
6 7
 from TimeConvert import TimeConvert as tc
7 8
 
8 9
 from group.models import GroupPhotoInfo
9
-from pai2.basemodels import CreateUpdateMixin
10 10
 
11 11
 
12
-class OrderInfo(CreateUpdateMixin):
12
+class OrderInfo(BaseModelMixin):
13 13
     NOMARK = 0
14 14
     ORIGIN = 1
15 15
 

+ 4 - 4
photo/models.py

@@ -2,12 +2,12 @@
2 2
 
3 3
 from django.db import models
4 4
 from django.utils.translation import ugettext_lazy as _
5
+from models_ext import BaseModelMixin
5 6
 
6
-from pai2.basemodels import CreateUpdateMixin
7 7
 from utils.qiniucdn import qiniu_file_url
8 8
 
9 9
 
10
-class UUIDInfo(CreateUpdateMixin):
10
+class UUIDInfo(BaseModelMixin):
11 11
     uuid = models.CharField(_(u'uuid'), max_length=22, blank=True, null=True, help_text=u'唯一标识', db_index=True, unique=True)
12 12
     lensman_id = models.CharField(_(u'lensman_id'), max_length=255, blank=True, null=True, help_text=u'摄影师唯一标识', db_index=True)
13 13
 
@@ -27,7 +27,7 @@ class UUIDInfo(CreateUpdateMixin):
27 27
         }
28 28
 
29 29
 
30
-class PhotoUUIDInfo(CreateUpdateMixin):
30
+class PhotoUUIDInfo(BaseModelMixin):
31 31
     photo_md5 = models.CharField(_(u'photo_md5'), max_length=255, blank=True, null=True, help_text=u'照片唯一标识', db_index=True, unique=True)
32 32
 
33 33
     photo_path = models.CharField(_(u'photo_path'), max_length=255, blank=True, null=True, help_text=u'照片路径')
@@ -54,7 +54,7 @@ class PhotoUUIDInfo(CreateUpdateMixin):
54 54
         return u'{0.pk}'.format(self)
55 55
 
56 56
 
57
-class PhotosInfo(CreateUpdateMixin):
57
+class PhotosInfo(BaseModelMixin):
58 58
     lensman_id = models.CharField(_(u'lensman_id'), max_length=255, blank=True, null=True, help_text=u'摄影师唯一标识', db_index=True)
59 59
     session_id = models.CharField(_(u'session_id'), max_length=255, blank=True, null=True, help_text=u'照片组唯一标识', db_index=True)
60 60
     photo_id = models.CharField(_(u'photo_id'), max_length=255, blank=True, null=True, help_text=u'照片唯一标识', db_index=True)