Coming soon - Get a detailed view of why an account is flagged as spam!
view details

This post has been de-listed

It is no longer included in search results and normal feeds (front page, hot posts, subreddit posts, etc). It remains visible only via the author's post history.

1
How to pass a list of tuples as context to a template and display as a html table in Django?
Post Body

I have a list of tuples named 'data' as shown below which is extracted from an SQL query using python. I need to pass this list as a context variable named 'data' in a view named homepage. This needs to be shown as an html table in the webpage with headers 'name', 'age', and 'gender'. I am not able to figure out how to loop through this data in the template. How should this be handled?

views.py

def homepage(request):
    data = [('Erica', 30, 'F'), ('Sabi', 25, 'M'), ('Sid', 39, 'M')]
    return(request, 'homepage.html', {'data': data})

Author
User Disabled
Account Strength
0%
Disabled 4 months ago
Account Age
5 years
Verified Email
Yes
Verified Flair
No
Total Karma
6,531
Link Karma
663
Comment Karma
5,737
Profile updated: 4 days ago
Posts updated: 1 year ago

Subreddit

Post Details

We try to extract some basic information from the post title. This is not always successful or accurate, please use your best judgement and compare these values to the post title and body for confirmation.
Posted
4 years ago