xhtml2pdf로 만든 pdf를 사용자가 컴퓨터에 다운로드하라는 일반적인 경로를 따르지 않고 서버에 직접 저장하는 스크립트를 작성하려고합니다. . Documents()는 저장하려고하는 모델이고 new_project 및 output_filename 변수는 다른 곳에 설정됩니다. 이 new_doc.save에 도달이 구성장고 - 서버의 디스크에 xhtml2pdf로 만든 PDF를 작성하십시오.
html = render_to_string(template, RequestContext(request, context)).encode('utf8')
result = open(output_filename, "wb")
pdf = CreatePDF(src=html, dest=results, path = "", encoding = 'UTF-8', link_callback=link_callback) #link callback was originally set to link_callback, defined below
result.close()
if not pdf.err:
new_doc=Documents()
new_doc.project=new_project
new_doc.posted_by=old_mess[0].from_user_fk.username
new_doc.documents = result
new_doc.save()
(I 오류 수) : '파일'개체가 어떤 속성이없는 '_committed을'
사람이 내가이 문제를 해결할 수있는 방법을 알고 있나요? 감사!