0

感谢您的帮助,由于我无法透露的原因,不得不将其删除。

4

1 回答 1

0

首先,而不是使用 multiwordReplace,为什么不将该数据呈现到模板中

t = loader.get_template('myapp/index.html')
c = Context({'foo': 'bar'})
t.render(c)

您还应该在 django, forms.py 中定义这些表单:

class PayPalForm(forms.Form):
    user = forms.HiddenField(required = True)
    currencycode = forms.CharField(required = True)
    cart_total = forms.CharField(required = True)

然后你可以做这样的事情:

t = loader.get_template('myapp/paypalform.html')
if site.uses_paypal_condition:
    f = PayPalForm()
else:
    f = SomeOtherPaymentForm()
c = Context({'payform': 'f'})
t.render(c)
于 2014-03-19T15:29:45.627 回答