Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
protokollsystem
proto3
Commits
18bb9969
Commit
18bb9969
authored
Feb 28, 2017
by
Robin Sonnabend
Browse files
Generate protocol template correctly
parent
32f6cef7
Changes
2
Hide whitespace changes
Inline
Side-by-side
models/database.py
View file @
18bb9969
...
...
@@ -218,6 +218,12 @@ class Protocol(db.Model):
def
get_originating_todos
(
self
):
return
[
todo
for
todo
in
self
.
todos
if
self
==
todo
.
get_first_protocol
()]
def
get_open_todos
(
self
):
return
[
todo
for
todo
in
self
.
protocoltype
.
todos
if
not
todo
.
is_done
()
]
def
has_compiled_document
(
self
):
candidates
=
[
document
for
document
in
self
.
documents
...
...
@@ -472,6 +478,13 @@ class Todo(db.Model):
self
.
get_state_plain
()
)
def
render_template
(
self
):
parts
=
[
"todo"
,
self
.
who
,
self
.
description
,
self
.
state
.
get_name
()]
if
self
.
state
.
needs_date
():
parts
.
append
(
date_filter
(
self
.
state
))
parts
.
append
(
"id {}"
.
format
(
self
.
get_id
()))
return
"[{}]"
.
format
(
";"
.
join
(
parts
))
class
TodoProtocolAssociation
(
db
.
Model
):
__tablename__
=
"todoprotocolassociations"
...
...
templates/protocol-template.txt
View file @
18bb9969
...
...
@@ -8,9 +8,10 @@
{% macro render_top(top) %}
{TOP {{top.name}}
{% if top.name == "Todos" %}
{% if protocol.todos|length > 0 %}
{% for todo in protocol.todos %}
[todo;{{todo.who}};{{todo.description}};id {{todo.get_id()}}];
{% set todos=protocol.get_open_todos() %}
{% if todos|length > 0 %}
{% for todo in todos %}
{{todo.render_template()}};
{% endfor %}
{% else %}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment