diff --git a/app.py b/app.py index d771416..586ecf2 100644 --- a/app.py +++ b/app.py @@ -11,7 +11,7 @@ def parks(): global _data if not _data: with open("data/parks.json") as f: - _data = {p["id"]: p for p in json.load(f)} + _data = {int(p["id"]): p for p in json.load(f)} return _data @@ -26,7 +26,7 @@ def about(): @app.route("/parks") -def staff(): +def park_list(): page = int(request.args.get("page", 1)) per_page = 10 total_items = len(parks()) @@ -45,7 +45,7 @@ def staff(): @app.route("/parks/") def park_detail(id_): - if park := parks().get(id_): - return render_template("staff_detail.html", employee=employee) + if park := parks().get(int(id_)): + return render_template("park_detail.html", park=park) else: abort(404) diff --git a/templates/park_detail.html b/templates/park_detail.html new file mode 100644 index 0000000..1c09e0c --- /dev/null +++ b/templates/park_detail.html @@ -0,0 +1,29 @@ +{% extends "base.html" %} + +{% block base %} +
+

{{ park.title }}

+
+
+
Address
+
+ {% autoescape false %} + {{ park.address|replace("\n","
") }} + {% endautoescape %} +
+
About
+
+ {% autoescape false %} + {{ park.description|replace("\n","
") }} + {% endautoescape %} +
+
History
+
+ {% autoescape false %} + {{ park.history|replace("\n","
") }} + {% endautoescape %} +
+
+
+
+{% endblock %} diff --git a/templates/parks.html b/templates/parks.html index 7293d13..1f64c8b 100644 --- a/templates/parks.html +++ b/templates/parks.html @@ -17,7 +17,7 @@ {{ e.title }} {{ e.address }} - Details + Details {% endfor %} diff --git a/templates/staff_detail.html b/templates/staff_detail.html deleted file mode 100644 index 6bb6969..0000000 --- a/templates/staff_detail.html +++ /dev/null @@ -1,19 +0,0 @@ -{% extends "base.html" %} - -{% block base %} -
-

Employee Details for {{ employee.first }} {{ employee.last }}

-
-
-
Position
-
{{ employee.position }}
-
Marital Status
-
{{ employee.status }}
-
Number of Children
-
{{ employee.children }}
-
Hired
-
{{ employee.hired }}
-
-
-
-{% endblock %}