update user_name

FFIB 1 week geleden
bovenliggende
commit
539b360302
1 gewijzigde bestanden met toevoegingen van 8 en 1 verwijderingen
  1. 8 1
      member/models.py

+ 8 - 1
member/models.py

@@ -11,6 +11,7 @@ from shortuuidfield import ShortUUIDField
11 11
 from TimeConvert import TimeConvert as tc
12 12
 
13 13
 from coupon.models import CouponInfo
14
+from account.models import LensmanInfo
14 15
 from kodo.basemodels import BrandInfoMixin
15 16
 from mch.models import ModelInfo
16 17
 from simditor.fields import RichTextField
@@ -997,6 +998,12 @@ class MemberActivityContributionInfo(BaseModelMixin, BrandInfoMixin):
997 998
     def admindata(self):
998 999
         unlock_welfares = MemberActivityContributionWelfareUnlockingInfo.objects.filter(activity_id=self.activity_id, user_id=self.user_id)
999 1000
         unlock_welfares = [unlock_welfare.data for unlock_welfare in unlock_welfares]
1001
+
1002
+        try:
1003
+            lensman = LensmanInfo.objects.get(user_id=self.user_id, status=True)
1004
+            lensman_name = lensman.name
1005
+        except:
1006
+            lensman_name = ''
1000 1007
     
1001 1008
         return {
1002 1009
             'contribution_id': self.contribution_id,
@@ -1008,7 +1015,7 @@ class MemberActivityContributionInfo(BaseModelMixin, BrandInfoMixin):
1008 1015
             'content_type': self.content_type,
1009 1016
             'title': self.title,
1010 1017
             'content': self.content,
1011
-            'user_name': self.user_name,
1018
+            'user_name': lensman_name if lensman_name else self.user_name,
1012 1019
             'user_avatar': self.final_user_avatar,
1013 1020
             'images': self.final_images,
1014 1021
             'video_url': self.video_url or '',