Skip to content Skip to sidebar Skip to footer

How Do I Get Jinja To Work On My Html Web Page

The table I am trying to fetch data from and put on the html web page is called 'Conservative' but none of the data appears on the web page where I have put the jinja variables. H

Solution 1:

I hope you're using SQLite3.

In sqlite3, if you are using cur.execute function, it will return sqlite3.Cursor, which is an iterator. And you can directly use for loop with this returned object.

Do remember, since this is an iterator, you will lose all the data once you read it.

So you have to save the data while you are reading. That's why you need to use .fetchall(), which will return the list of queryset.

Note: If you're using another db like postgres, pscopg2.cursor.execute function won't return anything like sqlite3.Cursor in sqlite, so you can't able to run the loop directly. You should call .fetchall() function.

Post a Comment for "How Do I Get Jinja To Work On My Html Web Page"