Guest User

Untitled

a guest
Apr 7th, 2020
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.10 KB | None | 0 0
  1. ################################### VIEW ##############################################
  2. def vote_stats_view(request):
  3. obj = Choice.objects.all()
  4. context = {
  5. 'object': obj
  6. }
  7.  
  8. return render(request, "polls/vote_stats.html", context)
  9. ################################### HTML ##############################################
  10. {% load static %}
  11.  
  12. <link rel="stylesheet" type="text/css" href="{% static 'polls/style.css' %}">
  13.  
  14. <body>
  15. <table summary="Tabela testowa 2" id="tabela">
  16. <tr>
  17. <td>
  18. <table summary="Tabela testowa" id="tabela">
  19.  
  20. <tr>
  21. <th scope="col">Question</th>
  22. <th scope="col">Choice</th>
  23. <th scope="col">Votes</th>
  24. </tr>
  25. {% for item in object %}
  26. <tr>
  27. <td>{{item.question.question_text}}</td>
  28. <td>{{item.choice_text}}</td>
  29.  
  30. <td>{{item.votes}}</td>
  31. </tr>
  32. {%endfor%}
  33. </table>
  34. </td>
  35. </tr>
  36. </table>
  37. </body>
Advertisement
Add Comment
Please, Sign In to add comment