From: Christian Heller <c.heller@plomlompom.de>
Date: Wed, 20 Mar 2024 02:37:25 +0000 (+0100)
Subject: Add date range input form to /calendar view.
X-Git-Url: https://plomlompom.com/repos/%7B%7Bdb.prefix%7D%7D/static/%7B%7Bprefix%7D%7D/todos?a=commitdiff_plain;h=af769db012fc0cf590b565c3368102b2f6099394;p=plomtask

Add date range input form to /calendar view.
---

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}}