Как устранить ошибку Positional Arguments в 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'
Как решить эту ошибку. amount - это поле в модели Payment model
Находится ли функция в классе? Если да, то вы пропустили 'self'