From af769db012fc0cf590b565c3368102b2f6099394 Mon Sep 17 00:00:00 2001
From: Christian Heller <c.heller@plomlompom.de>
Date: Wed, 20 Mar 2024 03:37:25 +0100
Subject: [PATCH] Add date range input form to /calendar view.

---
 plomtask/http.py        | 3 ++-
 templates/calendar.html | 5 +++++
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/plomtask/http.py b/plomtask/http.py
index b698fcb..58b575f 100644
--- a/plomtask/http.py
+++ b/plomtask/http.py
@@ -46,7 +46,8 @@ class TaskHandler(BaseHTTPRequestHandler):
     def do_GET_calendar(self, conn: DatabaseConnection, start: str, end: str):
         """Show Days."""
         return self.server.jinja.get_template('calendar.html').render(
-                days=Day.all(conn, date_range=(start, end)))
+                days=Day.all(conn, date_range=(start, end)),
+                start=start, end=end)
 
     def do_GET_day(self, conn: DatabaseConnection, date: str):
         """Show single Day."""
diff --git a/templates/calendar.html b/templates/calendar.html
index 0b7197f..3acdbc6 100644
--- a/templates/calendar.html
+++ b/templates/calendar.html
@@ -1,6 +1,11 @@
 {% extends 'base.html' %}
 
 {% block content %}
+<form action="calendar" method="GET">
+from <input name="start" value="{{start}}" />
+to <input name="end" value="{{end}}" />
+<input type="submit" value="OK" />
+</form>
 <ul>
 {% for day in days %}
 <li><a href="day?date={{day.date}}">{{day.date}}</a> ({{day.weekday}}) {{day.comment|e}}
-- 
2.30.2