django-paypal弃用错误:不赞成使用initial ['return_url']

问题描述

我正在尝试将django-paypal付款集成到我的应用程序中,但是即使我使用的是最新版本,也一直收到此错误。

Please use initial['return'] instead""",DeprecationWarning)
DeprecationWarning: The use of the initial['return_url'] is Deprecated.
Please use initial['return'] instead

这是在调用PayPalPaymentsForm

之后发生的
form = PayPalPaymentsForm(initial=paypal_dict,button_type="subscribe") 

对此有任何解决方法吗?

解决方法

只需按照说的做,将return_url更改为return

您可以从the related code中找到答案:

def _fix_deprecated_return_url(self,initial_args):
    if 'return_url' in initial_args:
        warn("""The use of the initial['return_url'] is Deprecated.
                Please use initial['return'] instead""",DeprecationWarning)
        initial_args['return'] = initial_args['return_url']
        del initial_args['return_url']
    return initial_args

相关问答

错误1:Request method ‘DELETE‘ not supported 错误还原:...
错误1:启动docker镜像时报错:Error response from daemon:...
错误1:private field ‘xxx‘ is never assigned 按Alt...
报错如下,通过源不能下载,最后警告pip需升级版本 Requirem...