{% extends 'base.html' %}
+{% macro process_with_children(node, indent) %}
+<tr>
+<td>
+<input type="checkbox" name="children" value="{{node.process.id_}}" checked />
+</td>
+<td>
+{% for i in range(indent) %}+{%endfor %}
+<a href="process?id={{node.process.id_}}">{{node.process.title.newest|e}}</a>
+</td>
+</tr>
+{% for child in node.children %}
+{{ process_with_children(child, indent+1) }}
+{% endfor %}
+{% endmacro %}
+
{% block content %}
<h3>Process</h3>
<form action="process?id={{process.id_ or ''}}" method="POST">
default effort: <input name="effort" type="number" step=0.1 value={{process.effort.newest}} />
<table>
{% for child in children %}
-<tr>
-<td>
-<input type="checkbox" name="children" value="{{child.id_}}" checked />
-</td>
-<td>
-<a href="process?id={{child.id_}}">{{child.title.newest|e}}</a>
-</td>
-</tr>
+{{ process_with_children(child, 0) }}
{% endfor %}
</table>
add child: <input name="children" list="candidates" autocomplete="off" />