@@ -98,7 +98,7 @@ class ModelInfoAdmin(DeleteModelAdmin, admin.ModelAdmin): |
||
98 | 98 |
|
99 | 99 |
|
100 | 100 |
class CameraModelInfoAdmin(admin.ModelAdmin): |
101 |
- list_display = ('brand_id', 'brand_name', 'camera_brand_name', 'camera_name', 'camera_image', 'status', 'created_at', 'updated_at') |
|
101 |
+ list_display = ('brand_id', 'brand_name', 'camera_brand_name', 'camera_name', 'camera_image', 'camera_market_time', 'status', 'created_at', 'updated_at') |
|
102 | 102 |
list_filter = ('brand_name', 'camera_brand_name', 'status') |
103 | 103 |
|
104 | 104 |
def save_model(self, request, obj, form, change): |
@@ -111,13 +111,14 @@ class CameraModelInfoAdmin(admin.ModelAdmin): |
||
111 | 111 |
camera_name=obj.camera_name, |
112 | 112 |
).update( |
113 | 113 |
camera_image=obj.camera_image, |
114 |
+ camera_market_time=obj.camera_market_time, |
|
114 | 115 |
) |
115 | 116 |
|
116 | 117 |
|
117 | 118 |
class ModelCameraBodyInfoAdmin(DeleteModelAdmin, admin.ModelAdmin): |
118 |
- list_display = ('brand_id', 'brand_name', 'model_name', 'model_full_name', 'model_image', 'is_important', 'camera_brand_name', 'camera_name', 'camera_image', 'status', 'created_at', 'updated_at') |
|
119 |
+ list_display = ('brand_id', 'brand_name', 'model_name', 'model_full_name', 'model_image', 'is_important', 'camera_brand_name', 'camera_name', 'camera_image', 'camera_market_time', 'status', 'created_at', 'updated_at') |
|
119 | 120 |
list_filter = ('brand_name', 'model_name', 'is_important', 'camera_brand_name', 'status') |
120 |
- readonly_fields = ('model_image', 'camera_image') |
|
121 |
+ readonly_fields = ('model_image', 'camera_image', 'camera_market_time') |
|
121 | 122 |
search_fields = ('brand_id', 'brand_name', 'model_name', 'model_full_name', 'camera_name') |
122 | 123 |
|
123 | 124 |
|
@@ -0,0 +1,20 @@ |
||
1 |
+# -*- coding: utf-8 -*- |
|
2 |
+# Generated by Django 1.11.28 on 2020-03-09 02:57 |
|
3 |
+from __future__ import unicode_literals |
|
4 |
+ |
|
5 |
+from django.db import migrations, models |
|
6 |
+ |
|
7 |
+ |
|
8 |
+class Migration(migrations.Migration): |
|
9 |
+ |
|
10 |
+ dependencies = [ |
|
11 |
+ ('mch', '0048_modelcamerabodyinfo_is_important'), |
|
12 |
+ ] |
|
13 |
+ |
|
14 |
+ operations = [ |
|
15 |
+ migrations.AddField( |
|
16 |
+ model_name='modelcamerabodyinfo', |
|
17 |
+ name='camera_market_time', |
|
18 |
+ field=models.DateField(blank=True, help_text='\u673a\u8eab\u4e0a\u5e02\u65e5\u671f', null=True, verbose_name='camera_market_time'), |
|
19 |
+ ), |
|
20 |
+ ] |
@@ -0,0 +1,20 @@ |
||
1 |
+# -*- coding: utf-8 -*- |
|
2 |
+# Generated by Django 1.11.28 on 2020-03-09 06:11 |
|
3 |
+from __future__ import unicode_literals |
|
4 |
+ |
|
5 |
+from django.db import migrations, models |
|
6 |
+ |
|
7 |
+ |
|
8 |
+class Migration(migrations.Migration): |
|
9 |
+ |
|
10 |
+ dependencies = [ |
|
11 |
+ ('mch', '0049_modelcamerabodyinfo_camera_market_time'), |
|
12 |
+ ] |
|
13 |
+ |
|
14 |
+ operations = [ |
|
15 |
+ migrations.AddField( |
|
16 |
+ model_name='cameramodelinfo', |
|
17 |
+ name='camera_market_time', |
|
18 |
+ field=models.DateField(blank=True, help_text='\u673a\u8eab\u4e0a\u5e02\u65e5\u671f', null=True, verbose_name='camera_market_time'), |
|
19 |
+ ), |
|
20 |
+ ] |
@@ -290,6 +290,7 @@ class CameraModelInfo(BaseModelMixin): |
||
290 | 290 |
camera_brand_name = models.CharField(_(u'camera_brand_name'), max_length=255, blank=True, null=True, help_text=u'机身品牌') |
291 | 291 |
camera_name = models.CharField(_(u'camera_name'), max_length=255, blank=True, null=True, help_text=u'机身名称') |
292 | 292 |
camera_image = models.ImageField(_(u'camera_image'), upload_to=upload_path, blank=True, null=True, help_text=u'机身图片') |
293 |
+ camera_market_time = models.DateField(_(u'camera_market_time'), blank=True, null=True, help_text=u'机身上市日期') |
|
293 | 294 |
|
294 | 295 |
class Meta: |
295 | 296 |
verbose_name = _(u'机身信息') |
@@ -311,6 +312,7 @@ class ModelCameraBodyInfo(BaseModelMixin): |
||
311 | 312 |
camera_brand_name = models.CharField(_(u'camera_brand_name'), max_length=255, blank=True, null=True, help_text=u'机身品牌') |
312 | 313 |
camera_name = models.CharField(_(u'camera_name'), max_length=255, blank=True, null=True, help_text=u'机身名称') |
313 | 314 |
camera_image = models.ImageField(_(u'camera_image'), upload_to=upload_path, blank=True, null=True, help_text=u'机身图片') |
315 |
+ camera_market_time = models.DateField(_(u'camera_market_time'), blank=True, null=True, help_text=u'机身上市日期') |
|
314 | 316 |
|
315 | 317 |
class Meta: |
316 | 318 |
verbose_name = _(u'型号机身适配信息') |
@@ -328,6 +330,12 @@ class ModelCameraBodyInfo(BaseModelMixin): |
||
328 | 330 |
return upload_file_url(self.camera_image) |
329 | 331 |
|
330 | 332 |
@property |
333 |
+ def final_camera_market_time(self): |
|
334 |
+ if not self.camera_market_time: |
|
335 |
+ return '' |
|
336 |
+ return tc.local_string(self.camera_market_time, format='%Y-%m-%d') |
|
337 |
+ |
|
338 |
+ @property |
|
331 | 339 |
def data(self): |
332 | 340 |
return { |
333 | 341 |
'model_name': self.model_name, |
@@ -336,6 +344,7 @@ class ModelCameraBodyInfo(BaseModelMixin): |
||
336 | 344 |
'camera_brand_name': self.camera_brand_name, |
337 | 345 |
'camera_name': self.camera_name, |
338 | 346 |
'camera_url': self.camera_url, |
347 |
+ 'camera_market_time': self.final_camera_market_time, |
|
339 | 348 |
} |
340 | 349 |
|
341 | 350 |
|