我正在尝试将paypal表单放在表单向导中。正在显示这些字段,但该按钮由于某种原因未显示。
我将表单向导包装在一个视图中,它正在运行。唯一缺少的是paypal按钮。
views.py
def add(request):
paypal_dict = {
"cmd": "_xclick-subscriptions",
"business": "alexbrand09@gmail.com",
"p3": 1, # duration of each unit (depends on unit)
"t3": "M", # duration unit ("M for Month")
"src": "1", # make payments recur
"sra": "1", # reattempt payment on payment error
"no_note": "1", # remove extra notes (optional)
"notify_url": "http://www.example.com/your-ipn-location/",
"return_url": "http://www.example.com/your-return-location/",
"cancel_return": "http://www.example.com/your-cancel-location/",
"custom": request.user.id
}
silver_payment = {
"a3": "15",
"item_name": "Silver Business Profile",
}
platinum_payment = {
"a3": "25",
"item_name": "Platinum Business Profile",
}
# add other keys from paypal_dict
silver_payment.update(paypal_dict)
platinum_payment.update(paypal_dict)
initial = {
'3':silver_payment,
'4':platinum_payment,
}
#create form wizard
form = AddWizard.as_view([AddForm1, AddForm2, AddForm3, PayPalPaymentsForm,PayPalPaymentsForm],
initial_dict = initial,
condition_dict = {
'1': basic_ad_selected,
'2': silver_ad_selected,
'3': silver_ad_selected,
'4': platinum_ad_selected
})
return form(context=RequestContext(request), request=request)
模板:
{% block content %}
{% load bootstrap %}
<h2>Payment Information</h2>
CARD FORM
<form action="" method="POST">{% csrf_token %}
{{ wizard.management_form }}
{% if wizard.form.forms %}
{{ wizard.form.management_form }}
{% for form in wizard.form.forms %}
{{ form|bootstrap }}
{% endfor %}
{% else %}
{{ wizard.form|bootstrap }}
{% endif %}
<br/><br/>
{% if wizard.steps.prev %}
<button class="btn" name="wizard_goto_step" type="submit" value="{{ wizard.steps.prev }}">« Go Back</button>
{% endif %}
<button class="btn btn-primary" type="submit" />Next »</button>
</form>
{% endblock %}
我不确定为什么paypal表单的所有字段都会出现而不是按钮本身
答案 0 :(得分:0)
bootstrap标签摆脱了按钮......
按钮现在显示。