【发布时间】:2019-12-01 23:44:42
【问题描述】:
我正在使用 Django 上的 STRIPE Gateway Payment,但在访问模板上的字典时遇到了问题。
我已经在纯 python 上做了并且工作正常。
这是我的看法
@login_required
def invoice_details(request):
customer = stripe.Customer.list(email=request.user)
return render(request, 'payment.html', customer)
在模板中这是我的代码:
<h2>{% trans "User details" %}</h2>
{% for actual_customer in customer.data %}
ID: {{ actual_customer.id }}
{% endfor %}
上面的代码不起作用,感谢任何帮助
【问题讨论】:
-
我建议你添加一个模板标签来获取字典项。显示here
标签: django python-2.7 dictionary django-templates