我有一个问题,我正在寻找执行以下任务的最佳方法。在
我很难找到确切的解决办法,我正在寻找。在
这是我的密码。在
prospects = Customer.objects.filter(state_id=2)
csvfile = StringIO.StringIO()
writer = UnicodeWriter(csvfile, encoding='utf-8')
writer.writerow(["Name", "Email"])
for prospect in prospects:
writer.writerow(
[prospect.name, prospect.email]
)
csvobj = csvfile.getvalue() # not sure about it.
msg = EmailMultiAlternatives(
subject="Innovation",
body="text_context",
from_email=settings.DEFAULT_FROM_EMAIL,
to=["bac@gmail.com"]
)
msg.attach("z.gzip",g, 'application/zip')
msg.send(True)
TypeError: 'GzipFile' object does not support indexing
这是我该怎么做的。
对我来说很好,如果你这么做你还会出错吗?
相关问题 更多 >
编程相关推荐