From 1b9c909cedf7e135f9b3ab977e9554a45d1f09d9 Mon Sep 17 00:00:00 2001 From: Christian Heller Date: Tue, 17 Oct 2023 00:54:48 +0200 Subject: [PATCH] In ledger.py, default new Booking to today. --- ledger.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ledger.py b/ledger.py index 640c63a..0dbc9fe 100755 --- a/ledger.py +++ b/ledger.py @@ -426,6 +426,7 @@ edit: return f'{self.header_add_form("add_free")}{self.footer_add_form(start, end)}' def add_structured(self, db, start=0, end=0, bonus_lines=10): + import datetime lines = db.get_lines(start, end) bookings, comments = parse_lines(lines) if len(bookings) > 1: @@ -436,7 +437,8 @@ edit: safe_val = html.escape(str(val)) return f'' if len(bookings) == 0: - input_lines += f'{inpu("date")} {inpu("description")} ; {inpu("comment")}
' + today = str(datetime.datetime.now())[:10] + input_lines += f'{inpu("date", today)} {inpu("description")} ; {inpu("comment")}
' last_line = 1 else: booking = bookings[0] -- 2.30.2