yelp.html 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. <!DOCTYPE html>
  2. <html>
  3. {% include 'hackathon/base.html' %}
  4. <style>
  5. .form-signin {
  6. max-width: 550px;
  7. padding: 15px;
  8. margin: 0 auto;
  9. }
  10. </style>
  11. <body>
  12. <h1 class="text-center"> Yelp API </h1>
  13. <div class="container text-center">
  14. <form class="form-signin" id="login_form" method="post" action="/hackathon/yelp/">
  15. {% csrf_token %}
  16. {% load bootstrap %}
  17. <br>
  18. <input type="text" name="location" class="form-control" placeholder="Enter a location, e.g: yelp-san-francisco" value="" required autofocus>
  19. <br>
  20. <button class="btn btn-lg btn-primary btn-block" type="submit">Search</button>
  21. <input type="hidden" name="submit" value="submit" />
  22. </form>
  23. </div>
  24. {% if data %}
  25. <div class="col-lg-12">
  26. <div class="table-responsive">
  27. <table class="table table-bordered table-hover table-striped tablesorter">
  28. <thead>
  29. <tr>
  30. <th class="header"> Name <i class="icon-sort"></i></th>
  31. <th class="header"> Snippet Text <i class="icon-sort"></i></th>
  32. <th class="header"> Open? <i class="icon-sort"></i></th>
  33. <th class="header"> Review Count <i class="icon-sort"></i></th>
  34. <th class="header"> URL <i class="icon-sort"></i></th>
  35. </tr>
  36. </thead>
  37. <tbody>
  38. {% for key in data %}
  39. <tr>
  40. <td>{{ key.name }}</td>
  41. <td>{{ key.snippet_text }}</td>
  42. <td>{{ key.is_closed }}</td>
  43. <td>{{ key.review_count }}</td>
  44. <td>{{ key.url |urlize }}</td>
  45. </tr>
  46. {% endfor %}
  47. </tbody>
  48. </table>
  49. </div>
  50. </div>
  51. {% endif %}
  52. </body>
  53. </html>