我有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)
我必须如何将它包含在我的基本应用示例中,以便所有功能都能正常工作并且pay.html呈现
答案 0 :(得分:0)
PayPalPaymentsForm应该收到一个对象,而不是一个dict。 因此,您可以将对象构建为参数。 例如:
form = PayPalPaymentsForm()
form.businness = paypal_dict["bussiness"]