-    brand_name = models.CharField(_(u'brand_name'), max_length=255, blank=True, null=True, help_text=u'品牌名称')
317
-
306
+class ShotTypeInfo(BaseModelMixin, BrandInfoMixin):
318 307
     shot_type_id = ShortUUIDField(_(u'shot_type_id'), max_length=32, blank=True, null=True, help_text=u'镜头类型唯一标识', db_index=True, unique=True)
319 308
     shot_type_name = models.CharField(_(u'shot_type_name'), max_length=255, blank=True, null=True, help_text=u'镜头类型名称')
320 309
 
@@ -341,7 +330,7 @@ class ShotTypeInfo(BaseModelMixin):
341 330
         }
342 331
 
343 332
 
344
-class MemberActivityInfo(BaseModelMixin):
333
+class MemberActivityInfo(BaseModelMixin, BrandInfoMixin):
345 334
     ACTIVITY_TYPE = (
346 335
         (0, u'线下活动'),
347 336
         (1, u'公众号文章'),
@@ -355,9 +344,6 @@ class MemberActivityInfo(BaseModelMixin):
355 344
         (2, u'下线'),
356 345
     )
357 346
 
358
-    brand_id = models.CharField(_(u'brand_id'), max_length=32, blank=True, default='', help_text=u'品牌唯一标识', db_index=True)
359
-    brand_name = models.CharField(_(u'brand_name'), max_length=255, blank=True, default='', help_text=u'品牌名称')
360
-
361 347
     activity_id = ShortUUIDField(_(u'activity_id'), max_length=32, blank=True, help_text=u'活动唯一标识', db_index=True, unique=True)
362 348
 
363 349
     activity_type = models.IntegerField(_(u'activity_type'), choices=ACTIVITY_TYPE, default=0, help_text=u'活动类型', db_index=True)
@@ -572,10 +558,7 @@ class MemberActivityInfo(BaseModelMixin):
572 558
         }
573 559
 
574 560
 
575
-class MemberActivitySignupInfo(BaseModelMixin):
576
-    brand_id = models.CharField(_(u'brand_id'), max_length=32, blank=True, null=True, help_text=u'品牌唯一标识', db_index=True)
577
-    brand_name = models.CharField(_(u'brand_name'), max_length=255, blank=True, null=True, help_text=u'品牌名称')
578
-
561
+class MemberActivitySignupInfo(BaseModelMixin, BrandInfoMixin):
579 562
     signup_id = ShortUUIDField(_(u'signup_id'), max_length=32, blank=True, null=True, help_text=u'活动报名唯一标识', db_index=True, unique=True)
580 563
 
581 564
     user_id = models.CharField(_(u'user_id'), max_length=32, blank=True, null=True, help_text=u'用户唯一标识', db_index=True)
@@ -610,10 +593,7 @@ class MemberActivitySignupInfo(BaseModelMixin):
610 593
         }
611 594
 
612 595
 
613
-class MemberActivitySigninInfo(BaseModelMixin):
614
-    brand_id = models.CharField(_(u'brand_id'), max_length=32, blank=True, null=True, help_text=u'品牌唯一标识', db_index=True)
615
-    brand_name = models.CharField(_(u'brand_name'), max_length=255, blank=True, null=True, help_text=u'品牌名称')
616
-
596
+class MemberActivitySigninInfo(BaseModelMixin, BrandInfoMixin):
617 597
     signin_id = ShortUUIDField(_(u'signin_id'), max_length=32, blank=True, null=True, help_text=u'活动签到唯一标识', db_index=True, unique=True)
618 598
 
619 599
     user_id = models.CharField(_(u'user_id'), max_length=32, blank=True, null=True, help_text=u'用户唯一标识', db_index=True)
@@ -634,10 +614,7 @@ class MemberActivitySigninInfo(BaseModelMixin):
634 614
         return '%d' % self.pk
635 615
 
636 616
 
637
-class MemberActivityGroupShareInfo(BaseModelMixin):
638
-    brand_id = models.CharField(_(u'brand_id'), max_length=32, blank=True, null=True, help_text=u'品牌唯一标识', db_index=True)
639
-    brand_name = models.CharField(_(u'brand_name'), max_length=255, blank=True, null=True, help_text=u'品牌名称')
640
-
617
+class MemberActivityGroupShareInfo(BaseModelMixin, BrandInfoMixin):
641 618
     group_share_id = ShortUUIDField(_(u'group_share_id'), max_length=32, blank=True, null=True, help_text=u'活动群组分享唯一标识', db_index=True)
642 619
 
643 620
     activity_id = models.CharField(_(u'activity_id'), max_length=32, blank=True, null=True, help_text=u'活动唯一标识', db_index=True)
@@ -664,7 +641,7 @@ class MemberActivityGroupShareInfo(BaseModelMixin):
664 641
         return '%d' % self.pk
665 642
 
666 643
 
667
-class MemberActivityContributionInfo(BaseModelMixin):
644
+class MemberActivityContributionInfo(BaseModelMixin, BrandInfoMixin):
668 645
     CONTENT_TYPE = (
669 646
         (0, u'投稿'),
670 647
         (1, u'创作日记'),
@@ -678,9 +655,6 @@ class MemberActivityContributionInfo(BaseModelMixin):
678 655
         (2, u'未通过'),
679 656
     )
680 657
 
681
-    brand_id = models.CharField(_(u'brand_id'), max_length=32, blank=True, null=True, help_text=u'品牌唯一标识', db_index=True)
682
-    brand_name = models.CharField(_(u'brand_name'), max_length=255, blank=True, null=True, help_text=u'品牌名称')
683
-
684 658
     contribution_id = ShortUUIDField(_(u'contribution_id'), max_length=32, blank=True, null=True, help_text=u'投稿唯一标识', db_index=True, unique=True)
685 659
 
686 660
     user_id = models.CharField(_(u'user_id'), max_length=32, blank=True, null=True, help_text=u'用户唯一标识', db_index=True)
@@ -715,6 +689,8 @@ class MemberActivityContributionInfo(BaseModelMixin):
715 689
     def data(self):
716 690
         return {
717 691
             'contribution_id': self.contribution_id,
692
+            'brand_id': self.brand_id,
693
+            'brand_name': self.brand_name,
718 694
             'user_id': self.user_id,
719 695
             'activity_id': self.activity_id,
720 696
             'content_type': self.content_type,
@@ -730,22 +706,18 @@ class MemberActivityContributionInfo(BaseModelMixin):
730 706
         }
731 707
 
732 708
 
733
-class MemberActivityContributionWelfareInfo(BaseModelMixin):
709
+class MemberActivityContributionWelfareInfo(BaseModelMixin, BrandInfoMixin):
734 710
     WELFARE_TYPE = (
735 711
         (0, u'实物'),
736 712
         (1, u'积分'),
737 713
         (2, u'虚拟'),
738 714
     )
739 715
 
740
-    brand_id = models.CharField(_(u'brand_id'), max_length=32, blank=True, null=True, help_text=u'品牌唯一标识', db_index=True)
741
-    brand_name = models.CharField(_(u'brand_name'), max_length=255, blank=True, null=True, help_text=u'品牌名称')
716
+    welfare_id = ShortUUIDField(_(u'welfare_id'), max_length=32, blank=True, null=True, help_text=u'福利唯一标识', db_index=True, unique=True)
742 717
 
743 718
     activity_id = models.CharField(_(u'activity_id'), max_length=32, blank=True, null=True, help_text=u'活动唯一标识', db_index=True)
744 719
 
745
-    welfare_id = ShortUUIDField(_(u'welfare_id'), max_length=32, blank=True, null=True, help_text=u'福利唯一标识', db_index=True, unique=True)
746
-
747 720
     welfare_type = models.IntegerField(_(u'welfare_type'), choices=WELFARE_TYPE, default=0, help_text=u'福利类型', db_index=True)
748
-
749 721
     welfare_title = models.CharField(_(u'welfare_title'), max_length=255, blank=True, null=True, help_text=u'福利标题')
750 722
     welfare_detail = RichTextField(_(u'welfare_detail'), blank=True, null=True, help_text=u'福利详情')
751 723
     welfare_value = models.IntegerField(_(u'welfare_value'), default=0, help_text=_(u'福利数量'))
@@ -771,8 +743,10 @@ class MemberActivityContributionWelfareInfo(BaseModelMixin):
771 743
     @property
772 744
     def data(self):
773 745
         return {
774
-            'activity_id': self.activity_id,
775 746
             'welfare_id': self.welfare_id,
747
+            'brand_id': self.brand_id,
748
+            'brand_name': self.brand_name,
749
+            'activity_id': self.activity_id,
776 750
             'welfare_type': self.welfare_type,
777 751
             'welfare_type_str': dict(MemberActivityContributionWelfareInfo.WELFARE_TYPE).get(self.welfare_type),
778 752
             'welfare_title': self.welfare_title,
@@ -781,3 +755,55 @@ class MemberActivityContributionWelfareInfo(BaseModelMixin):
781 755
             'welfare_image_url': self.welfare_image_url,
782 756
             'welfare_image_path': self.welfare_image_path,
783 757
         }
758
+
759
+
760
+class MemberActivityContributionWelfareUnlockingInfo(BaseModelMixin, BrandInfoMixin):
761
+    WELFARE_TYPE = (
762
+        (0, u'实物'),
763
+        (1, u'积分'),
764
+        (2, u'虚拟'),
765
+    )
766
+
767
+    unlocking_id = ShortUUIDField(_(u'unlocking_id'), max_length=32, blank=True, null=True, help_text=u'福利解锁唯一标识', db_index=True, unique=True)
768
+
769
+    admin_id = models.CharField(_(u'admin_id'), max_length=32, blank=True, null=True, help_text=u'管理员唯一标识', db_index=True)
770
+    user_id = models.CharField(_(u'user_id'), max_length=32, blank=True, null=True, help_text=u'用户唯一标识', db_index=True)
771
+
772
+    activity_id = models.CharField(_(u'activity_id'), max_length=32, blank=True, null=True, help_text=u'活动唯一标识', db_index=True)
773
+
774
+    contribution_id = models.CharField(_(u'contribution_id'), max_length=32, blank=True, null=True, help_text=u'投稿唯一标识', db_index=True)
775
+
776
+    welfare_id = models.CharField(_(u'welfare_id'), max_length=32, blank=True, null=True, help_text=u'福利唯一标识', db_index=True)
777
+
778
+    name = models.CharField(_(u'name'), max_length=255, blank=True, null=True, help_text=u'姓名')
779
+    phone = models.CharField(_(u'phone'), max_length=255, blank=True, null=True, help_text=u'电话')
780
+    address = models.CharField(_(u'address'), max_length=255, blank=True, null=True, help_text=u'地址')
781
+
782
+    tracking_number = models.CharField(_(u'tracking_number'), max_length=255, blank=True, null=True, help_text=u'快递单号')
783
+
784
+    is_handled = models.BooleanField(_(u'is_handled'), default=False, help_text=_(u'是否已处理'))
785
+
786
+    class Meta:
787
+        verbose_name = _(u'会员活动投稿福利解锁信息')
788
+        verbose_name_plural = _(u'会员活动投稿福利解锁信息')
789
+
790
+    def __unicode__(self):
791
+        return '%d' % self.pk
792
+
793
+    @property
794
+    def data(self):
795
+        return {
796
+            'unlocking_id': self.unlocking_id,
797
+            'brand_id': self.brand_id,
798
+            'brand_name': self.brand_name,
799
+            'admin_id': self.admin_id,
800
+            'user_id': self.user_id,
801
+            'activity_id': self.activity_id,
802
+            'contribution_id': self.contribution_id,
803
+            'welfare_id': self.welfare_id,
804
+            'name': self.name,
805
+            'phone': self.phone,
806
+            'address': self.address,
807
+            'tracking_number': self.tracking_number,
808
+            'is_handled': self.is_handled,
809
+        }

kodo - Gogs: Go Git Service

暫無描述

admin.py 1.1KB

    # -*- coding: utf-8 -*- from django.contrib import admin from django_admin import ChangeOnlyModelAdmin, ReadOnlyModelAdmin from account.models import UserInfo from mch.models import ConsumeInfoSubmitLogInfo class UserInfoAdmin(ChangeOnlyModelAdmin, admin.ModelAdmin): list_display = ('user_id', 'nickname', 'phone', 'appid', 'unionid', 'openid', 'openid_miniapp', 'location', 'balance', 'integral', 'freeze_integral', 'user_status', 'test_user', 'status', 'created_at', 'updated_at') list_filter = ('user_from', 'appid', 'subscribe', 'has_membercard', 'test_user', 'sex', 'user_status', 'status', 'code_version', 'new_subscribe', 'created_at', 'integral') readonly_fields = ('user_id', ) search_fields = ('user_id', 'username', 'unionid', 'openid', 'openid_miniapp', 'name', 'phone', 'location', 'memberusercardcode') def save_model(self, request, obj, form, change): obj.save() if obj.test_user: ConsumeInfoSubmitLogInfo.objects.filter(user_id=obj.user_id).update(test_user=True) admin.site.register(UserInfo, UserInfoAdmin)