verbose_name = _(u'会员活动投稿信息') verbose_name_plural = _(u'会员活动投稿信息') def __unicode__(self): return '%d' % self.pk @property def data(self): return { 'contribution_id': self.contribution_id, 'brand_id': self.brand_id, 'brand_name': self.brand_name, 'user_id': self.user_id, 'activity_id': self.activity_id, 'content_type': self.content_type, 'content_type_str': dict(MemberActivityContributionInfo.CONTENT_TYPE).get(self.content_type), 'title': self.title, 'content': self.content, 'user_name': self.user_name, 'user_avatar': self.user_avatar, 'images': self.images, 'video_url': self.video_url or '', 'audit_status': self.audit_status, 'audit_status_str': dict(MemberActivityContributionInfo.AUDIT_STATUS).get(self.audit_status), 'is_selected': self.is_selected, 'created_at': tc.local_string(utc_dt=self.created_at), } class MemberActivityContributionWelfareInfo(BaseModelMixin, BrandInfoMixin): WELFARE_TYPE = ( (0, u'实物'), (1, u'积分'), (2, u'虚拟'), ) welfare_id = ShortUUIDField(_(u'welfare_id'), max_length=32, blank=True, null=True, help_text=u'福利唯一标识', db_index=True, unique=True) activity_id = models.CharField(_(u'activity_id'), max_length=32, blank=True, null=True, help_text=u'活动唯一标识', db_index=True) welfare_type = models.IntegerField(_(u'welfare_type'), choices=WELFARE_TYPE, default=0, help_text=u'福利类型', db_index=True) welfare_title = models.CharField(_(u'welfare_title'), max_length=255, blank=True, null=True, help_text=u'福利标题') welfare_detail = RichTextField(_(u'welfare_detail'), blank=True, null=True, help_text=u'福利详情') welfare_value = models.IntegerField(_(u'welfare_value'), default=0, help_text=_(u'福利数量')) welfare_image = models.ImageField(_(u'welfare_image'), upload_to=upload_path, blank=True, null=True, help_text=u'福利图片') is_upload_qiniu = models.BooleanField(_(u'is_upload_qiniu'), default=False, help_text=_(u'是否已上传七牛')) class Meta: verbose_name = _(u'会员活动投稿福利信息') verbose_name_plural = _(u'会员活动投稿福利信息') def __unicode__(self): return '%d' % self.pk @property def welfare_image_path(self): return upload_file_path(self.welfare_image) @property def welfare_image_url(self): return qiniu_file_url(self.welfare_image.name, bucket='tamron') if self.is_upload_qiniu else upload_file_url(self.welfare_image) @property def data(self): return { 'welfare_id': self.welfare_id, 'brand_id': self.brand_id, 'brand_name': self.brand_name, 'activity_id': self.activity_id, 'welfare_type': self.welfare_type, 'welfare_type_str': dict(MemberActivityContributionWelfareInfo.WELFARE_TYPE).get(self.welfare_type), 'welfare_title': self.welfare_title, 'welfare_detail': self.welfare_detail, 'welfare_value': self.welfare_value, 'welfare_image_url': self.welfare_image_url, 'welfare_image_path': self.welfare_image_path, } class MemberActivityContributionWelfareUnlockingInfo(BaseModelMixin, BrandInfoMixin): WELFARE_TYPE = ( (0, u'实物'), (1, u'积分'), (2, u'虚拟'), ) unlocking_id = ShortUUIDField(_(u'unlocking_id'), max_length=32, blank=True, null=True, help_text=u'福利解锁唯一标识', db_index=True, unique=True) admin_id = models.CharField(_(u'admin_id'), max_length=32, blank=True, null=True, help_text=u'管理员唯一标识', db_index=True) user_id = models.CharField(_(u'user_id'), max_length=32, blank=True, null=True, help_text=u'用户唯一标识', db_index=True) activity_id = models.CharField(_(u'activity_id'), max_length=32, blank=True, null=True, help_text=u'活动唯一标识', db_index=True) contribution_id = models.CharField(_(u'contribution_id'), max_length=32, blank=True, null=True, help_text=u'投稿唯一标识', db_index=True) welfare_id = models.CharField(_(u'welfare_id'), max_length=32, blank=True, null=True, help_text=u'福利唯一标识', db_index=True) name = models.CharField(_(u'name'), max_length=255, blank=True, null=True, help_text=u'姓名') phone = models.CharField(_(u'phone'), max_length=255, blank=True, null=True, help_text=u'电话') address = models.CharField(_(u'address'), max_length=255, blank=True, null=True, help_text=u'地址') tracking_number = models.CharField(_(u'tracking_number'), max_length=255, blank=True, null=True, help_text=u'快递单号') is_handled = models.BooleanField(_(u'is_handled'), default=False, help_text=_(u'是否已处理')) class Meta: verbose_name = _(u'会员活动投稿福利解锁信息') verbose_name_plural = _(u'会员活动投稿福利解锁信息') def __unicode__(self): return '%d' % self.pk @property def data(self): try: welfare = MemberActivityContributionWelfareInfo.objects.get(welfare_id=self.welfare_id) except MemberActivityContributionWelfareInfo.DoesNotExist: welfare = None return { 'unlocking_id': self.unlocking_id, 'brand_id': self.brand_id, 'brand_name': self.brand_name, 'admin_id': self.admin_id, 'user_id': self.user_id, 'activity_id': self.activity_id, 'contribution_id': self.contribution_id, 'welfare_id': self.welfare_id, 'welfare': welfare.data if welfare else {}, 'name': self.name, 'phone': self.phone, 'address': self.address, 'tracking_number': self.tracking_number, 'is_handled': self.is_handled, } Pai2/pai2 - Gogs: Go Git Service

2 Ревизии (90877c0016282968ff62cc71c3858dc6fd7e780e)

Автор SHA1 Съобщение Дата
  Brightcells fabef63211 set line_length=200 for isort преди 10 години
  Brightcells 3114315824 add pc official website преди 10 години