Commit 7cd11f6e authored by Robin Sonnabend's avatar Robin Sonnabend
Browse files

Add default description to default tops

/close #108
parent 2a8a636d
"""empty message
Revision ID: c59998057d39
Revises: 70547c924023
Create Date: 2017-04-18 13:39:05.342669
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = 'c59998057d39'
down_revision = '70547c924023'
branch_labels = None
depends_on = None
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.add_column('defaulttops', sa.Column('description', sa.String(), nullable=True))
# ### end Alembic commands ###
def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.drop_column('defaulttops', 'description')
# ### end Alembic commands ###
...@@ -171,7 +171,7 @@ class Protocol(DatabaseModel): ...@@ -171,7 +171,7 @@ class Protocol(DatabaseModel):
local_tops = [] local_tops = []
for default_top in self.protocoltype.default_tops: for default_top in self.protocoltype.default_tops:
local_tops.append(LocalTOP(defaulttop_id=default_top.id, local_tops.append(LocalTOP(defaulttop_id=default_top.id,
protocol_id=self.id, description="")) protocol_id=self.id, description=default_top.description or ""))
return local_tops return local_tops
def fill_from_remarks(self, remarks): def fill_from_remarks(self, remarks):
...@@ -326,6 +326,7 @@ class DefaultTOP(DatabaseModel): ...@@ -326,6 +326,7 @@ class DefaultTOP(DatabaseModel):
protocoltype_id = db.Column(db.Integer, db.ForeignKey("protocoltypes.id")) protocoltype_id = db.Column(db.Integer, db.ForeignKey("protocoltypes.id"))
name = db.Column(db.String) name = db.Column(db.String)
number = db.Column(db.Integer) number = db.Column(db.Integer)
description = db.Column(db.String)
localtops = relationship("LocalTOP", backref=backref("defaulttop"), cascade="all, delete-orphan") localtops = relationship("LocalTOP", backref=backref("defaulttop"), cascade="all, delete-orphan")
......
...@@ -136,6 +136,7 @@ class ProtocolTypeForm(FlaskForm): ...@@ -136,6 +136,7 @@ class ProtocolTypeForm(FlaskForm):
class DefaultTopForm(FlaskForm): class DefaultTopForm(FlaskForm):
name = StringField("Name", validators=[InputRequired("Du musst einen Namen angeben.")]) name = StringField("Name", validators=[InputRequired("Du musst einen Namen angeben.")])
number = IntegerField("Nummer", validators=[InputRequired("Du musst eine Nummer angeben.")]) number = IntegerField("Nummer", validators=[InputRequired("Du musst eine Nummer angeben.")])
description = TextAreaField("Standardinhalt")
class MeetingReminderForm(FlaskForm): class MeetingReminderForm(FlaskForm):
days_before = IntegerField("Tage vor Sitzung", validators=[InputRequired("Du musst eine Dauer angeben.")]) days_before = IntegerField("Tage vor Sitzung", validators=[InputRequired("Du musst eine Dauer angeben.")])
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment