-1

我有 django-paypal views.py:

    from paypal.standard.forms import PayPalPaymentsForm

    def view_that_asks_for_money(request):

     paypal_dict = {
    "business": settings.PAYPAL_RECEIVER_EMAIL,
    "amount": "10000000.00",
    "item_name": "name of the item",
    "invoice": "unique-invoice-id",
    "notify_url": "https://www.example.com" + reverse('paypal-ipn'),
    "return_url": "https://www.example.com/your-return-location/",
    "cancel_return": "https://www.example.com/your-cancel-location/",

}

# Create the instance.
form = PayPalPaymentsForm(initial=paypal_dict)
context = {"form": form}
return render_to_response("payment.html", context)

我必须如何将它包含在我的基本应用程序示例中,以便所有功能都可以正常工作并呈现 payment.html

4

1 回答 1

0

PayPalPaymentsForm 应该是一个对象,而不是一个字典。因此,您可以构建一个对象作为参数。例如:

     form = PayPalPaymentsForm()
     form.businness = paypal_dict["bussiness"]
于 2015-03-22T10:25:09.343 回答