+ ('mch', '0045_auto_20200304_1826'),
+ ]
+
+ operations = [
+ migrations.CreateModel(
+ name='CameraModelInfo',
+ fields=[
+ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
+ ('status', models.BooleanField(db_index=True, default=True, help_text='Status', verbose_name='status')),
+ ('created_at', models.DateTimeField(auto_now_add=True, help_text='Create Time', verbose_name='created_at')),
+ ('updated_at', models.DateTimeField(auto_now=True, help_text='Update Time', verbose_name='updated_at')),
+ ('camera_brand_name', models.CharField(blank=True, help_text='\u673a\u8eab\u54c1\u724c', max_length=255, null=True, verbose_name='camera_brand_name')),
+ ('camera_name', models.CharField(blank=True, help_text='\u673a\u8eab\u540d\u79f0', max_length=255, null=True, verbose_name='camera_name')),
+ ('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')),
+ ],
+ options={
+ 'verbose_name': '\u673a\u8eab\u4fe1\u606f',
+ 'verbose_name_plural': '\u673a\u8eab\u4fe1\u606f',
+ },
+ ),
+ ]
@@ -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 |
+ ] |
@@ -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 |
|