/td>
+            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
 

tonglan/adminSystem - Gogs: Go Git Service

1 Commits (c867e20322b8b21d905cf4914db09d51295e400b)

Author SHA1 Nachricht Datum
  FFIB 11e3a9652a first vor 8 Jahren