내가 받고있는 오류에 대해 질문이 있습니다. 내 프로젝트를 위해 Synapse API를 기반으로 보내려고하는 쿼리가 있습니다. 나는 현재 senda 요청을 시도 중이며 API를 사용하여 새 사용자를 만듭니다. 요청을 보내려고 할 때마다 User 객체가 생성하지 않는다는 메시지가 나타납니다. 다음은 오류입니다.'user'객체에 'create'속성이 없습니다. - Django
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
다음은 새 사용자 생성 요청을 생성하는 현재 코드입니다. 이제
def createUserSynapse(request):
args = {
'email': '[email protected]',
'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)
내가 정상적인 쿼리 세트, 나는 다음과 같은 형식으로 객체를 가지고 있음을 알 수 있습니까
User.objects.create(client, **args)
하지만 난 내가
두 개의 매개 변수를 말한다 오류가 있다고 할 때 통과되고 1이 필요하므로 많은 변수가 전달되어야한다고 생각합니다 ... 오류가 어디에서오고 있는지 확실하지 않습니다 ...
여기는 내가 사용하는 중에 발생하는 오류입니다. User.objects.create
TypeError at /setup_profile/
create() takes 1 positional argument but 2 were given
Request Method: POST
Request URL: http://127.0.0.1:8000/setup_profile/
Django Version: 1.8.6
Exception Type: TypeError
Exception Value:
create() takes 1 positional argument but 2 were given
Exception Location: C:\Users\OmarJandali\AppData\Local\Programs\Python\Python36\lib\site-packages\django\db\models\manager.py in manager_method, line 127
이
클라이언트는 API 호출로 전달되어야하며 그 다음이 포함되어 업데이트] (클라이언트, ** 인수) :
import os
from synapse_pay_rest import Client
args = {
'client_id': 'client_id_...6YiBl',
'client_secret': 'client_secret_...kC3IF',
'fingerprint': '...dd48b',
'ip_address': '127.0.0.1',
'development_mode':True,
'logging':False
}
client = Client(**args)
을 또한 API 개발자가 만든 API 샘플에 대한 github 링크가 있습니다.
https://github.com/synapsepay/SynapsePayRest-Python
클라이언트는 키 워드 인수가 API 호출
나는 그것을 시도하지 못했습니다. \t POST 요청 URL : \t http://127.0.0.1:8000/setup_profile/ 내가/setup_profile/ '클라이언트'에 다음과 같은 메시지 ...'형식 오류를 가지고하면이 기능이 요청 방법에 대한 잘못된 키워드 인수입니다 Django 버전 : \t 1.8.6 예외 유형 : \t 유형 오류 예외 값 : \t '클라이언트'는이 함수에 대해 잘못된 키워드 인수입니다. ' 내 업데이 트와 내가 사용하는 API에 링크를 pleaase보세요 .. @neverwalkaloner –
@ OmarJandali 당신은 사용자를 만들려면 클라이언트를 전달하지 않아도됩니다. Tru this this : User.objects.create (** args) – neverwalkaloner
문제는 로컬 사용자를 만들지 않고, args를 API에 전달하려고하고 클라이언트를 통해 요청을 보내야한다는 것입니다. 클라이언트의 헤더 인수 .... 나는 그걸하는 법을 모르겠다[email protected] –