【发布时间】:2017-12-21 11:30:07
【问题描述】:
在报告中我尝试添加行和列但遇到错误
/billing/invioce_report/ 'int' 对象的 TypeError 不可迭代
product_data = [
str(bill.creation_date), bill.bill_number, bill.staff.user.first_name + " " + bill.staff.user.last_name,
products_in_bill.product_qty,
str(products_in_bill), products_in_bill.product.reference_number, products_in_bill.product.cost,
products_in_bill.discounted_price, products_in_bill.product.cost,
customer_name,
name,
comm_amount,
payment_type
]
print 123
tp = Table(product_data, 13 * [1.25 * inch], len(product_data) * [0.25 * inch])
tp.setStyle(TableStyle([('ALIGN', (1, 1), (-2, -2), 'RIGHT'),
('VALIGN', (0, 0), (0, -1), 'TOP'),
('ALIGN', (0, -1), (-1, -1), 'CENTER'),
('VALIGN', (0, -1), (-1, -1), 'MIDDLE'),
('INNERGRID', (0, 0), (-1, -1), 0.25, colors.black),
('BOX', (0, 0), (-1, -1), 0.25, colors.black),
]))
pdf_data.append(tp)
all_data.append(tp)
【问题讨论】:
标签: django python-2.7 reportlab pypdf pypdf2