cafes.html 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. {% extends 'bootstrap/base.html' %}
  2. {% block title %}Restaurants{% endblock %}
  3. {% block content %}
  4. <div class="container">
  5. <div class="row">
  6. <div class="col-sm-12">
  7. <h1>All Cafes</h1>
  8. <table class="table table-striped">
  9. <!-- This is where you will write the code to render a Bootstrap
  10. Table that contains all the information from the
  11. cafe-data.csv file. -->
  12. <thead>
  13. <tr>
  14. {% for h in cafes.pop(0) %}
  15. <th>{{ h }}</th>
  16. {% endfor %}
  17. </tr>
  18. </thead>
  19. <tbody>
  20. {% for row in cafes %}
  21. <tr>
  22. {% for attr in row %}
  23. <td>
  24. {% if attr.startswith('http') %}
  25. <a href="{{ attr }}" target="_blank">{{ attr }}</a>
  26. {% else %}
  27. {{ attr }}
  28. {% endif %}
  29. </td>
  30. {% endfor %}
  31. </tr>
  32. {% endfor %}
  33. </tbody>
  34. </table>
  35. <p><a href="/">Return to index page</a></p>
  36. <p><a href="{{ url_for('add') }}">Add the cafe</a></p>
  37. </div>
  38. </div>
  39. </div>
  40. {% endblock %}