My Document
model has a text_location
column, a file path that I need to read from after querying. I am using paginate
when querying.
That is created through this code:
class Document(db.Model):
id = db.Column(db.Integer, primary_key=True)
text_location = db.Column(db.String)
page_views = Document.query.paginate(page, 1, False)
I can display {{ page_views }}
correctly in the template. However, if I try to open text_location
, I get "Pagination" object has no attribute "text_location"
.
with open(page_views.text_location) as f:
document_text = f.read()
How can I read the text_location
for the Documents
I queried?