您的位置:首页 > 编程语言 > Go语言

django view返回中文名称文件

2015-10-16 10:44 483 查看
def shujubiao(request):
contact_id=request.GET["id"]
c=Contact.objects.get(id=contact_id)
fullfilepath = os.path.join(MEDIA_ROOT,"t_证书数据表.xml")
logging.info(fullfilepath)
data=genShujubiao(c,fullfilepath)
t=HttpResponse(data,content_type="text/xml")#application/application/vnd.openxmlformats-officedocument.spreadsheetml.sheet")#content_type="text/xml")#application/vnd.ms-excel")
tstr='attachment; filename=%s' % c.yonghu+"_"+c.yiqixinghao+"_证书数据表.xml"
t['Content-Disposition'] = tstr.encode("gb2312")
return t
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: