def __get_or_create(user): if AuthServicesInfo.objects.filter(user=user).exists(): return AuthServicesInfo.objects.get(user=user) else: # We have to create print 'here' authserviceinfo = AuthServicesInfo() authserviceinfo.user = user authserviceinfo.save() return authserviceinfo
def __get_or_create(user): if AuthServicesInfo.objects.filter(user=user).exists(): logger.debug("Returning existing authservicesinfo model for user %s" % user) return AuthServicesInfo.objects.get(user=user) else: # We have to create logger.info("Creating new authservicesinfo model for user %s" % user) authserviceinfo = AuthServicesInfo() authserviceinfo.user = user authserviceinfo.save() return authserviceinfo
def __get_or_create(user): if AuthServicesInfo.objects.filter(user=user).exists(): logger.debug( "Returning existing authservicesinfo model for user %s" % user) return AuthServicesInfo.objects.get(user=user) else: # We have to create logger.info("Creating new authservicesinfo model for user %s" % user) authserviceinfo = AuthServicesInfo() authserviceinfo.user = user authserviceinfo.save() return authserviceinfo