From: Christian Heller Date: Thu, 6 Jun 2024 05:30:02 +0000 (+0200) Subject: Allow creation of new Todos rather than just adoption from Todo edit view. X-Git-Url: https://plomlompom.com/repos/task?a=commitdiff_plain;h=2f4c681e1c4d78eacc1daa5f297f06038b45912e;p=plomtask Allow creation of new Todos rather than just adoption from Todo edit view. --- diff --git a/plomtask/http.py b/plomtask/http.py index 773548f..1a06f30 100644 --- a/plomtask/http.py +++ b/plomtask/http.py @@ -156,6 +156,7 @@ class TaskHandler(BaseHTTPRequestHandler): id_ = self.params.get_int('id') todo = Todo.by_id(self.conn, id_) return {'todo': todo, + 'process_candidates': Process.all(self.conn), 'todo_candidates': Todo.by_date(self.conn, todo.date), 'condition_candidates': Condition.all(self.conn)} @@ -359,6 +360,9 @@ class TaskHandler(BaseHTTPRequestHandler): continue child = Todo.by_id(self.conn, child_id) todo.add_child(child) + for process_id in self.form_data.get_all_int('make'): + made = Todo.create_with_children(self.conn, process_id, todo.date) + todo.add_child(made) effort = self.form_data.get_str('effort', ignore_strict=True) todo.effort = float(effort) if effort else None todo.set_conditions(self.conn, self.form_data.get_all_int('condition')) diff --git a/templates/todo.html b/templates/todo.html index a2ef536..870eab3 100644 --- a/templates/todo.html +++ b/templates/todo.html @@ -69,7 +69,8 @@ children -{{ macros.simple_checkbox_table("adopt", todo.children, "todo", "todo_candidates", "adopt", true) }} +{{ macros.simple_checkbox_table("adopt", todo.children, "todo", "todo_candidates", "adopt", true) }}
+make: @@ -77,6 +78,7 @@ {{ macros.datalist_of_titles("condition_candidates", condition_candidates) }} +{{ macros.datalist_of_titles("process_candidates", process_candidates) }} {% for candidate in todo_candidates %}