diff --git a/app.py b/app.py index bd871fd..bac2867 100644 --- a/app.py +++ b/app.py @@ -314,7 +314,30 @@ def episode_edit(season_id: int, episode_id: int): @app.route("/seasons//episodes//events/new", methods=["GET"]) @authorize def event_new(season_id: int, episode_id: int): - pass + model = { + "page_title": "New Event", + "form_title": "Create New Event", + "post_url": f"/seasons/{season_id}/episodes/{episode_id}/events/null/edit", + } + + return render_template("event_editor.html", model=model) + + +@app.route( + "/seasons//episodes//events//edit", + methods=["GET", "POST"], +) +@authorize +def event_edit(season_id: int, episode_id: int, event_id: int): + model = { + "page_title": "Edit Event", + "form_title": "Edit Event", + "post_url": f"/seasons/{season_id}/episodes/{episode_id}/events/{event_id}/edit" + } + if request.method == "GET": + return render_template("event_editor.html", model=model) + else: + pass @app.route("/players/new", methods=["GET"]) diff --git a/templates/event_editor.html b/templates/event_editor.html new file mode 100644 index 0000000..f4cddfc --- /dev/null +++ b/templates/event_editor.html @@ -0,0 +1,25 @@ +{% extends "base.html" %} +{% import "bootstrap/wtf.html" as wtf %} +{% set active_page = "seasons" %} +{% block title %}{{ model.page_title }} {{ super() }}{% endblock %} + +{% block page %} +
+

{{ model.form_title }}

+ + {% if model.errors %} +
+ {% for field, errors in model.errors.items() %} +
+ {{ field }}: + {{ errors|join(', ') }} +
+ {% endfor %} +
+ {% endif %} + +
+ +
+
+{% endblock %} \ No newline at end of file