Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
proto3
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
protokollsystem
proto3
Commits
39ba13c1
Commit
39ba13c1
authored
7 years ago
by
markus scheller
Browse files
Options
Downloads
Patches
Plain Diff
Added invitation storage
#179
parent
665469d1
No related branches found
No related tags found
1 merge request
!12
WIP: Resolve "Einladungen zum Aushängen drucken"
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
migrations/versions/45c336464a07_.py
+35
-0
35 additions, 0 deletions
migrations/versions/45c336464a07_.py
models/database.py
+32
-1
32 additions, 1 deletion
models/database.py
with
67 additions
and
1 deletion
migrations/versions/45c336464a07_.py
0 → 100644
+
35
−
0
View file @
39ba13c1
"""
empty message
Revision ID: 45c336464a07
Revises: 3b2e9b2b7579
Create Date: 2018-03-19 18:50:45.428045
"""
from
alembic
import
op
import
sqlalchemy
as
sa
# revision identifiers, used by Alembic.
revision
=
'
45c336464a07
'
down_revision
=
'
3b2e9b2b7579
'
branch_labels
=
None
depends_on
=
None
def
upgrade
():
# ### commands auto generated by Alembic - please adjust! ###
op
.
create_table
(
'
invitationdocuments
'
,
sa
.
Column
(
'
id
'
,
sa
.
Integer
(),
nullable
=
False
),
sa
.
Column
(
'
protocol_id
'
,
sa
.
Integer
(),
nullable
=
True
),
sa
.
Column
(
'
name
'
,
sa
.
String
(),
nullable
=
True
),
sa
.
Column
(
'
filename
'
,
sa
.
String
(),
nullable
=
True
),
sa
.
ForeignKeyConstraint
([
'
protocol_id
'
],
[
'
protocols.id
'
],
),
sa
.
PrimaryKeyConstraint
(
'
id
'
)
)
# ### end Alembic commands ###
def
downgrade
():
# ### commands auto generated by Alembic - please adjust! ###
op
.
drop_table
(
'
invitationdocuments
'
)
# ### end Alembic commands ###
This diff is collapsed.
Click to expand it.
models/database.py
+
32
−
1
View file @
39ba13c1
...
@@ -207,6 +207,9 @@ class Protocol(DatabaseModel):
...
@@ -207,6 +207,9 @@ class Protocol(DatabaseModel):
documents
=
relationship
(
documents
=
relationship
(
"
Document
"
,
backref
=
backref
(
"
protocol
"
),
"
Document
"
,
backref
=
backref
(
"
protocol
"
),
cascade
=
"
all, delete-orphan
"
,
order_by
=
"
Document.is_compiled
"
)
cascade
=
"
all, delete-orphan
"
,
order_by
=
"
Document.is_compiled
"
)
invitations
=
relationship
(
"
InvitationDocument
"
,
backref
=
backref
(
"
protocol
"
),
cascade
=
"
all, delete-orphan
"
,
order_by
=
"
InvitationDocument.id
"
)
errors
=
relationship
(
errors
=
relationship
(
"
Error
"
,
backref
=
backref
(
"
protocol
"
),
cascade
=
"
all, delete-orphan
"
,
"
Error
"
,
backref
=
backref
(
"
protocol
"
),
cascade
=
"
all, delete-orphan
"
,
order_by
=
"
Error.id
"
)
order_by
=
"
Error.id
"
)
...
@@ -584,6 +587,33 @@ def on_decisions_document_delete(mapper, connection, document):
...
@@ -584,6 +587,33 @@ def on_decisions_document_delete(mapper, connection, document):
os
.
remove
(
document_path
)
os
.
remove
(
document_path
)
class
InvitationDocument
(
DatabaseModel
):
__tablename__
=
"
invitationdocuments
"
__model_name__
=
"
invitationdocument
"
id
=
db
.
Column
(
db
.
Integer
,
primary_key
=
True
)
protocol_id
=
db
.
Column
(
db
.
Integer
,
db
.
ForeignKey
(
"
protocols.id
"
))
name
=
db
.
Column
(
db
.
String
)
filename
=
db
.
Column
(
db
.
String
)
def
get_parent
(
self
):
return
self
.
decision
def
get_filename
(
self
):
return
os
.
path
.
join
(
config
.
DOCUMENTS_PATH
,
self
.
filename
)
def
as_file_like
(
self
):
with
open
(
self
.
get_filename
(),
"
rb
"
)
as
file
:
return
BytesIO
(
file
.
read
())
@event.listens_for
(
InvitationDocument
,
"
before_delete
"
)
def
on_decisions_document_delete
(
mapper
,
connection
,
document
):
if
document
.
filename
is
not
None
:
document_path
=
document
.
get_filename
()
if
os
.
path
.
isfile
(
document_path
):
os
.
remove
(
document_path
)
class
TodoState
(
Enum
):
class
TodoState
(
Enum
):
open
=
0
open
=
0
waiting
=
1
waiting
=
1
...
@@ -933,5 +963,6 @@ class LikeTOPAssociation(DatabaseModel):
...
@@ -933,5 +963,6 @@ class LikeTOPAssociation(DatabaseModel):
ALL_MODELS
=
[
ALL_MODELS
=
[
ProtocolType
,
Protocol
,
DefaultTOP
,
TOP
,
Document
,
DecisionDocument
,
ProtocolType
,
Protocol
,
DefaultTOP
,
TOP
,
Document
,
DecisionDocument
,
Todo
,
Decision
,
MeetingReminder
,
Error
,
DefaultMeta
,
Meta
,
DecisionCategory
InvitationDocument
,
Todo
,
Decision
,
MeetingReminder
,
Error
,
DefaultMeta
,
Meta
,
DecisionCategory
]
]
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment