Skip to content
Snippets Groups Projects
Commit fcccf7cd authored by Robin Sonnabend's avatar Robin Sonnabend
Browse files

Add description to TOP, so some content can be written beforehand.

/close #14
parent 2cdf562e
No related branches found
No related tags found
No related merge requests found
"""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 ###
...@@ -302,12 +302,14 @@ class TOP(db.Model): ...@@ -302,12 +302,14 @@ class TOP(db.Model):
name = db.Column(db.String) name = db.Column(db.String)
number = db.Column(db.Integer) number = db.Column(db.Integer)
planned = db.Column(db.Boolean) 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.protocol_id = protocol_id
self.name = name self.name = name
self.number = number self.number = number
self.planned = planned self.planned = planned
self.description = description
def __repr__(self): def __repr__(self):
return "<TOP(id={}, protocol_id={}, name={}, number={}, planned={})>".format( return "<TOP(id={}, protocol_id={}, name={}, number={}, planned={})>".format(
......
...@@ -5,18 +5,21 @@ ...@@ -5,18 +5,21 @@
#Autor; #Autor;
#Ort; #Ort;
{% macro render_top(top) %} {% macro render_top(top, use_description=False) %}
{TOP {{top.name}} {TOP {{top.name}}
{% if top.name == "Todos" %} {% if top.name == "Todos" %}
{% set todos=protocol.get_open_todos() %} {% set todos=protocol.get_open_todos() %}
{% if todos|length > 0 %} {% if todos|length > 0 %}
{% for todo in todos %} {% for todo in todos %}
{{todo.render_template()}}; {{-todo.render_template()|indent(indentfirst=True)}};
{% endfor %} {% endfor %}
{% else %} {% else %}
{% endif %} {% endif %}
{% else %} {% else %}
{% if use_description %}
{{-top.description|indent(indentfirst=True)}}
{% endif %}
{% endif %} {% endif %}
} }
...@@ -30,7 +33,7 @@ ...@@ -30,7 +33,7 @@
{% endfor %} {% endfor %}
{% endif %} {% endif %}
{% for top in protocol.tops %} {% for top in protocol.tops %}
{{-render_top(top)}} {{-render_top(top, use_description=True)}}
{% endfor %} {% endfor %}
{% if not protocol.has_nonplanned_tops() %} {% if not protocol.has_nonplanned_tops() %}
{% for default_top in protocol.protocoltype.default_tops %} {% for default_top in protocol.protocoltype.default_tops %}
......
...@@ -127,6 +127,7 @@ class ProtocolForm(FlaskForm): ...@@ -127,6 +127,7 @@ class ProtocolForm(FlaskForm):
class TopForm(FlaskForm): class TopForm(FlaskForm):
name = StringField("TOP", validators=[InputRequired("Du musst den Namen des TOPs angeben.")]) 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.")]) number = IntegerField("Sortierung", validators=[InputRequired("Du musst eine Sortierung in der Reihenfolge angebene.")])
description = TextAreaField("Beschreibung")
class SearchForm(FlaskForm): class SearchForm(FlaskForm):
search = StringField("Suchbegriff") search = StringField("Suchbegriff")
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment