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
7cd11f6e
Commit
7cd11f6e
authored
Apr 18, 2017
by
Robin Sonnabend
Browse files
Add default description to default tops
/close
#108
parent
2a8a636d
Changes
3
Hide whitespace changes
Inline
Side-by-side
migrations/versions/c59998057d39_.py
0 → 100644
View file @
7cd11f6e
"""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 ###
models/database.py
View file @
7cd11f6e
...
@@ -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"
)
...
...
views/forms.py
View file @
7cd11f6e
...
@@ -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."
)])
...
...
Write
Preview
Supports
Markdown
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