home · contact · privacy
Disable Todo.is_done setting if children are not done yet.
[plomtask] / plomtask / http.py
index 5d165ecf90f1ca6ebaed77e55b73a5d55ff428b8..5a7126e3232176630d78ddd43b10bb659c425e94 100644 (file)
@@ -209,7 +209,12 @@ class TaskHandler(BaseHTTPRequestHandler):
         if child_id is not None:
             child = Todo.by_id(conn, child_id)
             todo.add_child(child)
-        todo.is_done = len(form_data.get_all_str('done')) > 0
+        if len(form_data.get_all_str('done')) > 0:
+            if not todo.is_doable:
+                raise BadFormatException('cannot set undoable Todo to done')
+            todo.is_done = True
+        else:
+            todo.is_done = False
         todo.save(conn)
 
     def do_POST_process(self, conn: DatabaseConnection, params: ParamsParser,