1

Have a code in function, which renders ResultProxy (as I understand), to template, like this:

query = db_session.execute(serious_business_query) #raw sql
return render_template('result.html', query=query)

I want to iterate through it in my template, but see nothing. How can I iterate through ResultProxy object? Or what should I pass to template to simply iterate through it?

Links to docs are OK, cant find what I need.

asyndrige
  • 572
  • 6
  • 23

1 Answers1

0

You might want to try this suggestion https://stackoverflow.com/a/17987782/1307985 and when you fill in a list from the cursor then to pass it to the template.

I am guessing, but probably the jinja2 template does not know how to itterate over cursor or query like object so it have to be converted to a list object.

Community
  • 1
  • 1
Velin Georgiev
  • 2,359
  • 1
  • 15
  • 21