在Postman上的URL上调用get方法时,我得到了:
TypeError: int() argument must be a string,
a bytes-like object or a number, not 'builtin_function_or_method'
代码:
def get_payment_scheduler(self, id):
userAccount = AccountManager.objects.get(id = id)
payment_scheduler = PaymentScheduler.objects.get(userAccount=userAccount)
if payment_scheduler.exists():
return payment_scheduler[0]
return None
AccountManager和PaymentSchedule具有一对一字段
期望这样:
{
"id": 12,
"purchaserId": null,
"subscriptionDate": "2019-09-27",
"validityDate": null,
"offer": "Free offer",
"priceTTC": "12.00",
"tva": "0.00",
"priceHT": "0.00",
"hasSubscribed": true,
"reader": "readerId"
}
答案 0 :(得分:3)
欢迎来到stackoverflow。我认为,这是因为BaseBottomSheetDialogThem
是python的函数,您也许忘了给邮递员的url调用提供参数。如果您打开python控制台,则可以看到id
声明:
id
您应该使用另一个变量名,以便获得更好的错误消息。