我对遇到的错误有疑问。我有一个查询要尝试根据我的项目的 Synapse Api 发送。我目前正在尝试发送请求,使用 API 创建一个新用户。每次我尝试发送请求时,我都会收到一条消息,指出用户对象没有创建。这是错误。
AttributeError at /setup_profile/
type object 'User' has no attribute 'create'
Request Method: POST
Request URL: http://127.0.0.1:8000/setup_profile/
Django Version: 1.8.6
Exception Type: AttributeError
Exception Value:
type object 'User' has no attribute 'create'
Exception Location: C:\Users\OmarJandali\Desktop\opentab\opentab\tab\views.py in createUserSynapse, line 1104
Run Code Online (Sandbox Code Playgroud)
这是我当前的代码,它将创建创建新用户的请求。
def createUserSynapse(request):
args = {
'email': 'hello@synapsepay.com',
'phone_number': '555-555-5555',
'legal_name': 'Hello McHello',
'note': ':)', # optional
'supp_id': '123abc', # optional
'is_business': True,
'cip_tag': 1
}
user = User.create(client, **args)
print(user)
Run Code Online (Sandbox Code Playgroud)
现在我确实知道,使用正常的查询集,我的对象具有以下格式
User.objects.create(client, **args)
Run Code Online (Sandbox Code Playgroud)
但是当我这样做时,我收到一条错误消息
正在传递两个参数,1 …