+    dependencies = [
12
+        ('mch', '0045_auto_20200304_1826'),
13
+    ]
14
+
15
+    operations = [
16
+        migrations.CreateModel(
17
+            name='CameraModelInfo',
18
+            fields=[
19
+                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
20
+                ('status', models.BooleanField(db_index=True, default=True, help_text='Status', verbose_name='status')),
21
+                ('created_at', models.DateTimeField(auto_now_add=True, help_text='Create Time', verbose_name='created_at')),
22
+                ('updated_at', models.DateTimeField(auto_now=True, help_text='Update Time', verbose_name='updated_at')),
23
+                ('camera_brand_name', models.CharField(blank=True, help_text='\u673a\u8eab\u54c1\u724c', max_length=255, null=True, verbose_name='camera_brand_name')),
24
+                ('camera_name', models.CharField(blank=True, help_text='\u673a\u8eab\u540d\u79f0', max_length=255, null=True, verbose_name='camera_name')),
25
+                ('camera_image', models.ImageField(blank=True, help_text='\u673a\u8eab\u56fe\u7247', null=True, upload_to=django_models_ext.fileext.upload_path, verbose_name='camera_image')),
26
+            ],
27
+            options={
28
+                'verbose_name': '\u673a\u8eab\u4fe1\u606f',
29
+                'verbose_name_plural': '\u673a\u8eab\u4fe1\u606f',
30
+            },
31
+        ),
32
+    ]

+ 25 - 0
mch/migrations/0047_auto_20200304_1848.py

@@ -0,0 +1,25 @@
1
+# -*- coding: utf-8 -*-
2
+# Generated by Django 1.11.28 on 2020-03-04 10:48
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', '0046_cameramodelinfo'),
12
+    ]
13
+
14
+    operations = [
15
+        migrations.AddField(
16
+            model_name='cameramodelinfo',
17
+            name='brand_id',
18
+            field=models.CharField(blank=True, db_index=True, help_text='\u54c1\u724c\u552f\u4e00\u6807\u8bc6', max_length=32, null=True, verbose_name='brand_id'),
19
+        ),
20
+        migrations.AddField(
21
+            model_name='cameramodelinfo',
22
+            name='brand_name',
23
+            field=models.CharField(blank=True, help_text='\u54c1\u724c\u540d\u79f0', max_length=255, null=True, verbose_name='brand_name'),
24
+        ),
25
+    ]

+ 30 - 2
mch/models.py

@@ -283,15 +283,33 @@ class ModelImageInfo(BaseModelMixin):
283 283
         }
284 284
 
285 285
 
286
+class CameraModelInfo(BaseModelMixin):
287
+    brand_id = models.CharField(_(u'brand_id'), max_length=32, blank=True, null=True, help_text=u'品牌唯一标识', db_index=True)
288
+    brand_name = models.CharField(_(u'brand_name'), max_length=255, blank=True, null=True, help_text=u'品牌名称')
289
+
290
+    camera_brand_name = models.CharField(_(u'camera_brand_name'), max_length=255, blank=True, null=True, help_text=u'机身品牌')
291
+    camera_name = models.CharField(_(u'camera_name'), max_length=255, blank=True, null=True, help_text=u'机身名称')
292
+    camera_image = models.ImageField(_(u'camera_image'), upload_to=upload_path, blank=True, null=True, help_text=u'机身图片')
293
+
294
+    class Meta:
295
+        verbose_name = _(u'机身信息')
296
+        verbose_name_plural = _(u'机身信息')
297
+
298
+    def __unicode__(self):
299
+        return unicode(self.pk)
300
+
301
+
286 302
 class ModelCameraBodyInfo(BaseModelMixin):
287 303
     brand_id = models.CharField(_(u'brand_id'), max_length=32, blank=True, null=True, help_text=u'品牌唯一标识', db_index=True)
288 304
     brand_name = models.CharField(_(u'brand_name'), max_length=255, blank=True, null=True, help_text=u'品牌名称')
289 305
 
290 306
     model_name = models.CharField(_(u'model_name'), max_length=32, blank=True, null=True, help_text=u'型号名称')
291 307
     model_full_name = models.CharField(_(u'model_full_name'), max_length=255, blank=True, null=True, help_text=u'型号全名称')
308
+    model_image = models.ImageField(_(u'model_image'), upload_to=upload_path, blank=True, null=True, help_text=u'镜头图片')
292 309
 
293
-    camera_name = models.CharField(_(u'camera_name'), max_length=255, blank=True, null=True, help_text=u'机身名称')
294 310
     camera_brand_name = models.CharField(_(u'camera_brand_name'), max_length=255, blank=True, null=True, help_text=u'机身品牌')
311
+    camera_name = models.CharField(_(u'camera_name'), max_length=255, blank=True, null=True, help_text=u'机身名称')
312
+    camera_image = models.ImageField(_(u'camera_image'), upload_to=upload_path, blank=True, null=True, help_text=u'机身图片')
295 313
 
296 314
     class Meta:
297 315
         verbose_name = _(u'型号机身适配信息')
@@ -301,12 +319,22 @@ class ModelCameraBodyInfo(BaseModelMixin):
301 319
         return unicode(self.pk)
302 320
 
303 321
     @property
322
+    def model_url(self):
323
+        return upload_file_url(self.model_image)
324
+
325
+    @property
326
+    def camera_url(self):
327
+        return upload_file_url(self.camera_image)
328
+
329
+    @property
304 330
     def data(self):
305 331
         return {
306 332
             'model_name': self.model_name,
307 333
             'model_full_name': self.model_full_name,
308
-            'camera_name': self.camera_name,
334
+            'model_url': self.model_url,
309 335
             'camera_brand_name': self.camera_brand_name,
336
+            'camera_name': self.camera_name,
337
+            'camera_url': self.camera_url,
310 338
         }
311 339
 
312 340
 

kodo - Gogs: Go Git Service

Няма описание

0007_auto_20160907_1740.py 591B

    # -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations class Migration(migrations.Migration): dependencies = [ ('message', '0006_systemmessageinfo_src'), ] operations = [ migrations.AlterField( model_name='systemmessageinfo', name='src', field=models.IntegerField(default=0, help_text='\u7cfb\u7edf\u6d88\u606f\u7c7b\u522b', db_index=True, verbose_name='src', choices=[(0, '\u62cd\u7231\u7528\u6237\u7aef'), (1, '\u62cd\u7231\u6444\u5f71\u5e08\u7aef')]), ), ]