From: Christian Heller Date: Wed, 15 May 2024 06:51:00 +0000 (+0200) Subject: Add Todo.comment display/posting in Todo view. X-Git-Url: https://plomlompom.com/repos/%7B%7Bprefix%7D%7D/static/%7B%7Byoutube_prefix%7D%7D%7B%7Bvideo_id%7D%7D?a=commitdiff_plain;h=e60bbd142b5026748ee2181ca6758afef6202fb4;p=plomtask Add Todo.comment display/posting in Todo view. --- diff --git a/plomtask/http.py b/plomtask/http.py index 15f8376..2ecfcaa 100644 --- a/plomtask/http.py +++ b/plomtask/http.py @@ -248,6 +248,7 @@ class TaskHandler(BaseHTTPRequestHandler): todo.set_enables(self.conn, self.form_data.get_all_int('enables')) todo.set_disables(self.conn, self.form_data.get_all_int('disables')) todo.is_done = len(self.form_data.get_all_str('done')) > 0 + todo.comment = self.form_data.get_str('comment') todo.save(self.conn) for condition in todo.enables: condition.save(self.conn) diff --git a/templates/todo.html b/templates/todo.html index 41a9eb1..f50b635 100644 --- a/templates/todo.html +++ b/templates/todo.html @@ -8,6 +8,7 @@ id: {{todo.id_}}
day: {{todo.date}}
process: {{todo.process.title.newest|e}}
done:
+comment:

conditions

diff --git a/tests/todos.py b/tests/todos.py index 419d3db..3158ecb 100644 --- a/tests/todos.py +++ b/tests/todos.py @@ -272,15 +272,15 @@ class TestsWithServer(TestCaseWithServer): self.check_post({}, '/todo?id=FOO', 400) self.check_post({}, '/todo?id=0', 404) # test posting naked entity - todo1 = post_and_reload({}) + todo1 = post_and_reload({'comment': ''}) self.assertEqual(todo1.children, []) self.assertEqual(todo1.parents, []) self.assertEqual(todo1.is_done, False) # test posting doneness - todo1 = post_and_reload({'done': ''}) + todo1 = post_and_reload({'done': '', 'comment': ''}) self.assertEqual(todo1.is_done, True) # test implicitly posting non-doneness - todo1 = post_and_reload({}) + todo1 = post_and_reload({'comment': ''}) self.assertEqual(todo1.is_done, False) # test malformed adoptions self.check_post({'adopt': 'foo'}, '/todo?id=1', 400) @@ -290,17 +290,17 @@ class TestsWithServer(TestCaseWithServer): self.check_post({'day_comment': '', 'new_todo': 1}, '/day?date=2024-01-01', 302) # test todo 1 adopting todo 2 - todo1 = post_and_reload({'adopt': 2}) + todo1 = post_and_reload({'adopt': 2, 'comment': ''}) todo2 = Todo.by_date(self.db_conn, '2024-01-01')[1] self.assertEqual(todo1.children, [todo2]) self.assertEqual(todo1.parents, []) self.assertEqual(todo2.children, []) self.assertEqual(todo2.parents, [todo1]) # test todo1 cannot be set done with todo2 not done yet - todo1 = post_and_reload({'done': '', 'adopt': 2}, 400) + todo1 = post_and_reload({'done': '', 'adopt': 2, 'comment': ''}, 400) self.assertEqual(todo1.is_done, False) # test todo1 un-adopting todo 2 by just not sending an adopt - todo1 = post_and_reload({}, 302) + todo1 = post_and_reload({'comment': ''}, 302) todo2 = Todo.by_date(self.db_conn, '2024-01-01')[1] self.assertEqual(todo1.children, []) self.assertEqual(todo1.parents, [])