from sqlite3 import Row
from plomtask.db import DatabaseConnection, BaseModel
from plomtask.processes import Process
+from plomtask.versioned_attributes import VersionedAttribute
from plomtask.conditions import Condition, ConditionsRelations
from plomtask.exceptions import (NotFoundException, BadFormatException,
HandledException)
for condition in self.disables:
condition.is_active = False
+ @property
+ def title(self) -> VersionedAttribute:
+ """Shortcut to .process.title."""
+ return self.process.title
+
def adopt_from(self, todos: list[Todo]) -> bool:
"""As far as possible, fill unsatisfied dependencies from todos."""
adopted = False
</form>
-{{ macros.datalist_of_direct_titles("processes", processes) }}
+{{ macros.datalist_of_titles("processes", processes) }}
{% endblock %}
{{ macros.edit_buttons() }}
</form>
-{{ macros.datalist_of_direct_titles("condition_candidates", condition_candidates) }}
-{{ macros.datalist_of_direct_titles("step_candidates", step_candidates) }}
+{{ macros.datalist_of_titles("condition_candidates", condition_candidates) }}
+{{ macros.datalist_of_titles("step_candidates", step_candidates) }}
{% endblock %}
<tr>
<th>children</th>
-<td>
-<table>
-{% for child in todo.children %}
-<tr>
-<td><input type="checkbox" name="adopt" value="{{child.id_}}" checked /></td>
-<td><a href="todo?id={{child.id_}}">{{child.process.title.newest|e}}</a></td>
-</tr>
-{% endfor %}
-</table>
-adopt: <input name="adopt" list="todo_candidates" autocomplete="off" />
-</td>
+<td>{{ macros.simple_checkbox_table("adopt", todo.children, "adopt", "todo_candidates", "adopt") }}</td>
</tr>
</table>
{{ macros.edit_buttons() }}
</form>
-{{ macros.datalist_of_direct_titles("condition_candidates", condition_candidates) }}
-{{ macros.datalist_of_indirect_titles("todo_candidates", todo_candidates) }}
+{{ macros.datalist_of_titles("condition_candidates", condition_candidates) }}
+{{ macros.datalist_of_titles("todo_candidates", todo_candidates) }}
{% endblock %}