谢谢!
我找到解决办法
烧瓶
sms_body = shop.sms_body
print(sms_body)
sms_body = Template(sms_body)
list_sms_body = [sms_body.render(shop=shop, location=location, order=order) for order in orders]
if orders == []:
return redirect(url_for("remind.update_remind_customer", date=date))
else:
return render_template('/remind_customer.html', orders=orders, shop=shop, location=location, date=date,
next_date=next_date, pre_date=pre_date, list_sms_body=list_sms_body)
之后在html中
{% if shop.use_remind_customers == True %}
{% for index in range(orders|length) %}
{% set order = orders[index] %}
{% set sms_body = list_sms_body[index] %}
<a class="text-left"
href="sms:{{ order.canonicalForm }}&body={{ sms_body|safe }}"><img
src="/static/img/sms_icon.png" width="30px"></a>
{% endfor %}
{% endif %}