diff globalneighbors/templates/city.html @ 23:6891c5523b69

load with neighbors :)
author Jeff Hammel <k0scist@gmail.com>
date Sun, 25 Jun 2017 18:13:43 -0700
parents 21095c9006e5
children
line wrap: on
line diff
--- a/globalneighbors/templates/city.html	Sun Jun 25 17:45:19 2017 -0700
+++ b/globalneighbors/templates/city.html	Sun Jun 25 18:13:43 2017 -0700
@@ -24,5 +24,22 @@
       <dt>Country:</dt>
       <dd>{{ city['country code'] }}
     </dl>
+
+    {% if neighbors %}
+    <div>
+    <p>
+      {{ neighbors|length }} nearest neighbors:
+    </p>
+    <table>
+      <tr><th>Neighbor</th><th>Distance (km)</th></tr>
+      {% for neighbor in neighbors %}
+      <tr>
+        <td><a href="/{{ neighbor.geoid }}">{{ neighbor.name }}</a></td>
+        <td>{{ neighbor.distance }}</td>
+      </tr>
+      {% endfor %}
+    </table>
+    </div>
+    {% endif %}
   </body>
 </html>