diff --git a/server.py b/server.py index 353038feb4d4dd7b7274597c1513e5c6a7622796..0e938e02aaefbf0382c4a058a19a49dbd98853e5 100755 --- a/server.py +++ b/server.py @@ -174,7 +174,7 @@ def index(): ] def _todo_sort_key(todo): protocol = todo.get_first_protocol() - return protocol.date if protocol.date is not None else datetime.now().date() + return protocol.date if protocol is not None and protocol.date is not None else datetime.now().date() todos = sorted(todos, key=_todo_sort_key, reverse=True) todos_table = TodosTable(todos) if todos is not None else None return render_template("index.html", open_protocols=open_protocols, protocol=protocol, todos=todos) diff --git a/views/tables.py b/views/tables.py index e7290d29492e54f3d262d895a2e48b391a0a7d9f..e1fae0bdff9daee75f1c608f44c6ef907b6e320e 100644 --- a/views/tables.py +++ b/views/tables.py @@ -319,12 +319,12 @@ class TodosTable(Table): def row(self, todo): user = current_user() protocol = todo.get_first_protocol() + mobile_parts = [Table.link(url_for("show_todo", todo_id=todo.id), todo.get_state())] + if protocol is not None: + mobile_parts.append(Table.link(url_for("show_protocol", protocol_id=protocol.id), todo.protocoltype.short_name)) + mobile_parts.append(todo.who) row = [ - Markup("<br>").join([ - Table.link(url_for("show_todo", todo_id=todo.id), todo.get_state()), - Table.link(url_for("show_protocol", protocol_id=protocol.id), todo.protocoltype.short_name), - todo.who - ]), + Markup("<br>").join(mobile_parts), Table.link(url_for("show_todo", todo_id=todo.id), todo.get_id()), todo.get_state(), Table.link(url_for("show_protocol", protocol_id=protocol.id), protocol.get_identifier())