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 is_real_audit_normal(user_profile): if not (user_profile.bitState is None): if BitStatesUtils.hasState(user_profile.bitState, BitStatesUtils.GET_OP_REAL_AUTH()): return True return False
def isRealAuth(self): return BitStatesUtils.hasState(self.bitState, BitStatesUtils.GET_OP_REAL_AUTH())