form1 = PayPalPaymentsForm(initial=paypal_dict)
print form1
context = {"form1": form1.render(paypal_dict['amount']),}
print context
return render_to_response('choose_plan.html',context)
这会将上下文发送到html,但它现在显示此错误。
render() takes exactly 1 argument (2 given)
我完全不知道为什么。
答案 0 :(得分:2)
因为render是对象form1
中的函数,并且只需要self
参数。由于您将一个参数传递给调用中的函数,该函数成为第二个参数。