mirror of
https://github.com/sartography/cr-connect-workflow.git
synced 2025-02-23 21:28:32 +00:00
FileModel => DocumentModel
This commit is contained in:
parent
aaca206465
commit
e46a855eae
@ -7,7 +7,7 @@ from docxtpl import Listing
|
|||||||
from io import BytesIO
|
from io import BytesIO
|
||||||
|
|
||||||
from crc import session
|
from crc import session
|
||||||
from crc.models.file import FileModel, FileDataModel
|
from crc.models.file import DocumentModel
|
||||||
from crc.services.jinja_service import JinjaService
|
from crc.services.jinja_service import JinjaService
|
||||||
|
|
||||||
|
|
||||||
@ -52,15 +52,15 @@ class TestEmbeddedTemplate(BaseTest):
|
|||||||
self.complete_form(workflow, task, data)
|
self.complete_form(workflow, task, data)
|
||||||
|
|
||||||
# Get the file data created for us in the workflow
|
# Get the file data created for us in the workflow
|
||||||
file_model = session.query(FileModel).\
|
file_model = session.query(DocumentModel).\
|
||||||
filter(FileModel.workflow_id == workflow.id).\
|
filter(DocumentModel.workflow_id == workflow.id).\
|
||||||
filter(FileModel.irb_doc_code == 'Study_App_Doc').\
|
filter(DocumentModel.irb_doc_code == 'Study_App_Doc').\
|
||||||
first()
|
|
||||||
file_data_model = session.query(FileDataModel). \
|
|
||||||
filter(FileDataModel.file_model_id == file_model.id).\
|
|
||||||
first()
|
first()
|
||||||
|
# file_data_model = session.query(FileDataModel). \
|
||||||
|
# filter(FileDataModel.file_model_id == file_model.id).\
|
||||||
|
# first()
|
||||||
|
|
||||||
# read the data as a word document
|
# read the data as a word document
|
||||||
document = docx.Document(BytesIO(file_data_model.data))
|
document = docx.Document(BytesIO(file_model.data))
|
||||||
# Make sure 'Hello World!' is there
|
# Make sure 'Hello World!' is there
|
||||||
self.assertEqual('Hello World!', document.paragraphs[4].text)
|
self.assertEqual('Hello World!', document.paragraphs[4].text)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user