Tuesday, January 28, 2020

Re: How to render data from populated database (no user input) to html

On Monday, January 20, 2020 at 11:59:01 AM UTC+5:30, nmax...@gmail.com wrote:
I would like to render data from a populated database into a HTML (homepage_view).  I am not sure if I create a <form> GET method from the database (and if so how) or use (fix) the code listed below. 

The ultimate outcome is to have a table with three columns (models.py) with six rows.  Note:  In the home.html (below), I did hardcode the headers but tried a "for loop" to populate the data. 

I am using Python 3.8, Django 2.2, Windows 10, sqlite3 and bootstrap.

Please any help would be truly appreciated.

You can use django-tables2 to create tables from model data.
It is very simple by using django-tables2.

-- 
Suraj

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/e9118353-de5a-48db-a281-053c545946e2%40googlegroups.com.

No comments:

Post a Comment