def save_models(self): #获取保持对象 obj = self.new_obj obj.save() if obj is not None: real_auth = obj real_auth.auditor = self.user.username real_auth.audiTime = timezone.now() user_profile = UserProfile.objects.filter( username=real_auth.applier).first() #审核成功给用户添加审核成功状态位 if real_auth.state == BitStatesUtils.STATE_AUDIT(): # user_profile = UserProfile.objects.filter(username=real_auth.applier).first() user_profile.real_auth_id = real_auth.id # 添加审核通过状态位 user_profile.bitState = BitStatesUtils.addState( user_profile.bitState, BitStatesUtils.GET_OP_REAL_AUTH()) user_profile.save() else: # user_profile = UserProfile.objects.filter(username=real_auth.applier).first() #用户的实名认证取消 user_profile.real_auth_id = None #状态位更改 if BitStatesUtils.hasState(user_profile.bitState, BitStatesUtils.GET_OP_REAL_AUTH()): user_profile.bitState = BitStatesUtils.removeState( user_profile.bitState, BitStatesUtils.GET_OP_REAL_AUTH()) user_profile.save() # real_auth.course_nums = Course.objects.filter(course_org=course_org).count() real_auth.save()
def save_models(self): #获取保持对象 obj = self.new_obj obj.save() if obj is not None: vedio_auth = obj vedio_auth.auditor = self.user.username vedio_auth.audiTime = timezone.now() #添加视频认证状态位 user_profile = UserProfile.objects.filter( username=vedio_auth.applier).first() user_profile.bitState = BitStatesUtils.addState( user_profile.bitState, BitStatesUtils.GET_OP_VEDIO_AUTH()) user_profile.save()
def addState(self, value): self.bitState = BitStatesUtils.addState(self.bitState, value)