From: Christian Heller Date: Mon, 16 Oct 2023 22:54:48 +0000 (+0200) Subject: In ledger.py, default new Booking to today. X-Git-Url: https://plomlompom.com/repos/%22https:/validator.w3.org/%7B%7Bprefix%7D%7D/%7Broute%7D?a=commitdiff_plain;h=1b9c909cedf7e135f9b3ab977e9554a45d1f09d9;p=misc In ledger.py, default new Booking to today. --- 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]