如何解决Python中的位置参数错误



我收到以下代码的错误。我如何才能解决这个错误

def verify_payment (request: HttpRequest, ref: str, amount )-> HttpResponse:
payment = get_object_or_404(Payment, ref=ref)
amount = get_object_or_404(Payment, amount=amount)
verified = payment.verify_payment()
if verified :
with transaction.atomic():
account = Account.objects.select_for_update().get(user=request.user)
account.balance += amount
asof = account.modified 
account.save(update_fields=[
'balance',
'modified',
])
else:
messages.error(request, "verification failed")
return redirect('initiate-payment')

错误

response = wrapped_callback(request, *callback_args, **callback_kwargs)
TypeError: verify_payment() missing 1 required positional argument: 'amount'

如何解决此错误。金额是支付模型中的一个字段

函数在类中吗?如果是的话,你错过了"自我">

相关内容

  • 没有找到相关文章

最新更新