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
fcccf7cd
Commit
fcccf7cd
authored
Mar 01, 2017
by
Robin Sonnabend
Browse files
Add description to TOP, so some content can be written beforehand.
/close
#14
parent
2cdf562e
Changes
4
Hide whitespace changes
Inline
Side-by-side
migrations/versions/ab996d2365af_.py
0 → 100644
View file @
fcccf7cd
"""empty message
Revision ID: ab996d2365af
Revises: a1f23743bddb
Create Date: 2017-03-01 03:27:25.199271
"""
from
alembic
import
op
import
sqlalchemy
as
sa
# revision identifiers, used by Alembic.
revision
=
'ab996d2365af'
down_revision
=
'a1f23743bddb'
branch_labels
=
None
depends_on
=
None
def
upgrade
():
# ### commands auto generated by Alembic - please adjust! ###
op
.
add_column
(
'tops'
,
sa
.
Column
(
'description'
,
sa
.
String
(),
nullable
=
True
))
# ### end Alembic commands ###
def
downgrade
():
# ### commands auto generated by Alembic - please adjust! ###
op
.
drop_column
(
'tops'
,
'description'
)
# ### end Alembic commands ###
models/database.py
View file @
fcccf7cd
...
...
@@ -302,12 +302,14 @@ class TOP(db.Model):
name
=
db
.
Column
(
db
.
String
)
number
=
db
.
Column
(
db
.
Integer
)
planned
=
db
.
Column
(
db
.
Boolean
)
description
=
db
.
Column
(
db
.
String
)
def
__init__
(
self
,
protocol_id
,
name
,
number
,
planned
):
def
__init__
(
self
,
protocol_id
,
name
,
number
,
planned
,
description
):
self
.
protocol_id
=
protocol_id
self
.
name
=
name
self
.
number
=
number
self
.
planned
=
planned
self
.
description
=
description
def
__repr__
(
self
):
return
"<TOP(id={}, protocol_id={}, name={}, number={}, planned={})>"
.
format
(
...
...
templates/protocol-template.txt
View file @
fcccf7cd
...
...
@@ -5,18 +5,21 @@
#Autor;
#Ort;
{% macro render_top(top) %}
{% macro render_top(top
, use_description=False
) %}
{TOP {{top.name}}
{% if top.name == "Todos" %}
{% set todos=protocol.get_open_todos() %}
{% if todos|length > 0 %}
{% for todo in todos %}
{{todo.render_template()}};
{{
-
todo.render_template()
|indent(indentfirst=True)
}};
{% endfor %}
{% else %}
{% endif %}
{% else %}
{% if use_description %}
{{-top.description|indent(indentfirst=True)}}
{% endif %}
{% endif %}
}
...
...
@@ -30,7 +33,7 @@
{% endfor %}
{% endif %}
{% for top in protocol.tops %}
{{-render_top(top)}}
{{-render_top(top
, use_description=True
)}}
{% endfor %}
{% if not protocol.has_nonplanned_tops() %}
{% for default_top in protocol.protocoltype.default_tops %}
...
...
views/forms.py
View file @
fcccf7cd
...
...
@@ -127,6 +127,7 @@ class ProtocolForm(FlaskForm):
class
TopForm
(
FlaskForm
):
name
=
StringField
(
"TOP"
,
validators
=
[
InputRequired
(
"Du musst den Namen des TOPs angeben."
)])
number
=
IntegerField
(
"Sortierung"
,
validators
=
[
InputRequired
(
"Du musst eine Sortierung in der Reihenfolge angebene."
)])
description
=
TextAreaField
(
"Beschreibung"
)
class
SearchForm
(
FlaskForm
):
search
=
StringField
(
"Suchbegriff"
)
...
...
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