home · contact · privacy
Add date range input form to /calendar view.
authorChristian Heller <c.heller@plomlompom.de>
Wed, 20 Mar 2024 02:37:25 +0000 (03:37 +0100)
committerChristian Heller <c.heller@plomlompom.de>
Wed, 20 Mar 2024 02:37:25 +0000 (03:37 +0100)
plomtask/http.py
templates/calendar.html

index b698fcbef94b73d790c6346e9bc8db7b5f4e7e33..58b575f837774e5f6106b61b32ec452ff395c2b0 100644 (file)
@@ -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."""
index 0b7197fd526b171c81d112171abf83f69fb9b354..3acdbc6fc2205e67e0c4e514130e4e33ad292e66 100644 (file)
@@ -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}}