I'm trying to filter (by column element) and display information from a sqlite3 database directly onto a HTML table. I've read in multiple places that you should use Django's ORM instead of a database. However, the data is continuously updating in the database so I'm not sure if this is a route to pursue with this. TL;DR I'm looking for a way to open a sqlite3 .db file and chuck it into an HTML table.
I have looked over the django documentation regarding models, as well as looked at several different websites/tutorials (here, stack overflow; I even found django-tables2 which I thought was going to work), all to no avail. I'm essentially at a roadblock and I'm not sure where to go and/or what to do.
Here is how the database is structured:
---------------------------------------------
| Name | Type | Col 1 | ... | Col N | Color |
---------------------------------------------
| Gary | A | Data | ... | Data! | Green |
| Mark | A | Data | ... | Data? | Blue |
| Ray | B | Data | ... | Data. | Red |
...
As far as the HTML is concerned, I'd like to use for loop similar to this:
<table>
<tr>
<th>Name</th>
<th>Type</th>
<th>Col 1</th>
...
<th>Col N</th>
</tr>
{% for row in data %}
<tr>
<td>{{ row }}</td>
</tr>
{% endfor %}
</table>
One thing to note as well is that the last column in the above sample database is not being shown on the table.
sqlite3and usedataTablesto show the data. It's a bit hard to know what you need here