0
我試圖在表單嚮導中放入一個paypal表單。字段正在顯示,但由於某種原因,按鈕不顯示。Django表單嚮導和django-paypal
我將窗體嚮導包裝在視圖中,它正在工作。唯一缺少的是貝寶按鈕。
views.py
def add(request):
paypal_dict = {
"cmd": "_xclick-subscriptions",
"business": "[email protected]",
"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 %}
我不知道爲什麼貝寶形式的所有領域會出現,但不是按鈕本身