From b3c5a0bec2c978aa4c8b7facf44d11fb7a602313 Mon Sep 17 00:00:00 2001 From: clerie Date: Wed, 8 Apr 2020 18:02:02 +0200 Subject: [PATCH] Add station info --- wetter/models.py | 2 ++ wetter/templates/index.html | 2 +- wetter/templates/station.html | 20 +++++++++++++++++--- wetter/templates/stations.html | 2 ++ wetter/views.py | 1 + 5 files changed, 23 insertions(+), 4 deletions(-) diff --git a/wetter/models.py b/wetter/models.py index 8e362f7..2b5a86e 100644 --- a/wetter/models.py +++ b/wetter/models.py @@ -10,6 +10,8 @@ class Stations(db.Model): lon = db.Column(db.Integer) dwd_id = db.Column(db.String) dwd_last_update = db.Column(db.TIMESTAMP) + state = db.Column(db.String) + sea_level = db.Column(db.Integer) class Climate(db.Model): __tablename__ = 'climate' diff --git a/wetter/templates/index.html b/wetter/templates/index.html index 17b9f7b..79d87c9 100644 --- a/wetter/templates/index.html +++ b/wetter/templates/index.html @@ -45,7 +45,7 @@ mymap.setView([stations[0]["lat"], stations[0]["lon"]], 6); } stations.forEach((station, i, j) => { - L.marker([station["lat"], station["lon"]]).addTo(mymap).bindPopup("

" + station["name"] + "

Export Info"); + L.marker([station["lat"], station["lon"]]).addTo(mymap).bindPopup("

" + station["name"] + "

" + station["state"] + "

Export Info"); }) }); diff --git a/wetter/templates/station.html b/wetter/templates/station.html index 498a597..fdc949d 100644 --- a/wetter/templates/station.html +++ b/wetter/templates/station.html @@ -20,14 +20,28 @@
-
Ort
-

+
Latitude
+

{{ station.lat }}°

+
+
+
Longitude
+

{{ station.lon}}°

+
+
+
+
+
Höhe über nn
+

{{ station.sea_level }}m

+
+
+
+
Bundesland
-

+

{{ station.state }}

diff --git a/wetter/templates/stations.html b/wetter/templates/stations.html index d5b7e66..3379722 100644 --- a/wetter/templates/stations.html +++ b/wetter/templates/stations.html @@ -14,6 +14,7 @@ Name + Bundesland @@ -21,6 +22,7 @@ {% for station in stations %} {{ station.name }} + {{ station.state }} Export Info {% endfor %} diff --git a/wetter/views.py b/wetter/views.py index bec66f0..dfdc52a 100644 --- a/wetter/views.py +++ b/wetter/views.py @@ -156,6 +156,7 @@ def api_station(): "lat": float(s.lat), "lon": float(s.lon), "dwd_id": str(s.dwd_id), + "state": str(s.state), }) return jsonify(out)