I'm try to use a Django page as front-end using some AWS DynamoDB tables as 
back-end. To do so, I use boto3 library and it gets the data from the table 
correctly but I'm not able to parse the data into a HTML table. I have the 
following in views.py

def history(request):
     itemsid = list()
     agents = list()
     dates = list()
     source = list()
     dynamodb_resource('dynamodb')
     history_table = dynamodb_resource.Table('name_of_the_table')
     all_items = history_table.scan()
     for p in all_items['Items']:
       itemsid.append((p['id'])),
       agents.append((p['agent'])),
       dates.append((p['date'])),
       source.append((p['source']))
    return render(request, 'history.html', {'itemsid':itemsid, 'agents':agents, 
'dates':dates, 'source':source}

The issue is that I don't know how to write the html code to show a table 
with the rows: id, agent, date and source. 

I have the following in history.html


<table>
  {% for i in itemsid %}
  <tr>
    <td>{{ i }}</td>
    ...

but I don't know how to code it (how to loop it) to show the table with the 
lists as source. 

Any idea please about how to parse a Json with the following format into a 
HTML with Django and Python please?. 

JSON from DynamoDB:


{
  'Items: [ {
    'id': '94f'
    'agent': 'aws'
    'date': '04/05
    'source': 'case1'
  }, {
    'id': 'lk42'
      ...
Thank you so much. I'm new in Django and in programming in general so any help 
is much appreciate. 



-- 
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/0dcfb1d9-a08c-4a90-9be4-cc968f44540d%40googlegroups.com.

Reply via email to