django trying to put a table in a view -
in views.py:
def show(request): query_results=emails.objects.all() #from py_utils import open_py_shell;open_py_shell.open_py_shell() context = { 'query_result' : query_results } homecoming render(request, 'show.html', context)
in show.html:
<table id="example" class="display" cellspacing="0" width="100%"> <thead> <tr> <th>name</th> <th>position</th> <th>office</th> <th>age</th> <th>start date</th> <th>salary</th> </tr> </thead> <tfoot> <tr> <th>name</th> <th>position</th> <th>office</th> <th>age</th> <th>start date</th> <th>salary</th> </tr> </tfoot> <tbody> {% item in query_result %} <tr> <td>ohad</td> <td>{{ item.email }}</td> <td>{{ item.baseurl }}</td> </tr> {% endfor %} </tbody> </table>
an email object has email field , baseurl field seems cannot load it, checked , in query_result
have list of emails object cannot set in table, help?
django
No comments:
Post a Comment