I'm looking for the best way to pull info from the datastore into a list (with the intention of outputting to ReportLab to generate a pdf). Is there a way to do it besides looping through the output, and creating a list fro开发者_如何学编程m it?
Per the source fetch()
returns a list:
Returns: A list of db.Model instances...
The results of that query will look something like this:
[<models.YourModel object at 0x02641B30>,
<models.YourModel object at 0x02641B70>]
Edit:
And then to get certain attributes of the model instances you'd do something like this:
values = [(model.name, model.type, model.source)
for model
in models_returned_from_query]
I don't know of any further shortcut for the above.
精彩评论