Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
nopaque
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Monitor
Service Desk
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
SFB 1288 - INF
nopaque
Commits
65becc11
"...ipaaca.git" did not exist on "0906549c0ba0feae192dd453c02d0b0bedac77e0"
Commit
65becc11
authored
5 years ago
by
Patrick Jentsch
Browse files
Options
Downloads
Patches
Plain Diff
Add creation_data to corpus.
parent
32c6b9ab
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
app/main/views.py
+5
-9
5 additions, 9 deletions
app/main/views.py
app/models.py
+2
-1
2 additions, 1 deletion
app/models.py
migrations/versions/c425353fb4dc_add_creation_data_to_corpus.py
+28
-0
28 additions, 0 deletions
...ions/versions/c425353fb4dc_add_creation_data_to_corpus.py
with
35 additions
and
10 deletions
app/main/views.py
+
5
−
9
View file @
65becc11
...
...
@@ -7,7 +7,6 @@ from . import main
from
.forms
import
CreateCorpusForm
from
..decorators
import
admin_required
from
..
import
db
import
hashlib
import
os
...
...
@@ -28,14 +27,11 @@ def dashboard():
if
create_corpus_form
.
validate_on_submit
():
app
=
current_app
.
_get_current_object
()
corpus
=
{
'
description
'
:
create_corpus_form
.
description
.
data
,
'
id
'
:
id
,
'
creator
'
:
current_user
.
id
,
'
title
'
:
create_corpus_form
.
title
.
data
}
corpus
=
Corpus
(
description
=
create_corpus_form
.
description
.
data
,
title
=
create_corpus_form
.
title
.
data
,
user_id
=
current_user
.
id
)
corpus
=
Corpus
()
corpus
.
creation_date
=
datetime
.
utcnow
()
corpus
.
description
=
create_corpus_form
.
description
.
data
,
corpus
.
title
=
create_corpus_form
.
title
.
data
,
corpus
.
user_id
=
current_user
.
id
db
.
session
.
add
(
corpus
)
db
.
session
.
commit
()
dir
=
os
.
path
.
join
(
app
.
config
[
'
OPAQUE_STORAGE
'
],
...
...
This diff is collapsed.
Click to expand it.
app/models.py
+
2
−
1
View file @
65becc11
...
...
@@ -107,9 +107,9 @@ class User(UserMixin, db.Model):
# Primary key
id
=
db
.
Column
(
db
.
Integer
,
primary_key
=
True
)
confirmed
=
db
.
Column
(
db
.
Boolean
,
default
=
False
)
registration_date
=
db
.
Column
(
db
.
DateTime
(),
default
=
datetime
.
utcnow
)
email
=
db
.
Column
(
db
.
String
(
64
),
unique
=
True
,
index
=
True
)
password_hash
=
db
.
Column
(
db
.
String
(
128
))
registration_date
=
db
.
Column
(
db
.
DateTime
(),
default
=
datetime
.
utcnow
)
role_id
=
db
.
Column
(
db
.
Integer
,
db
.
ForeignKey
(
'
roles.id
'
))
username
=
db
.
Column
(
db
.
String
(
64
),
unique
=
True
,
index
=
True
)
# Relationships
...
...
@@ -259,6 +259,7 @@ class Corpus(db.Model):
__tablename__
=
'
corpora
'
# Primary key
id
=
db
.
Column
(
db
.
Integer
,
primary_key
=
True
)
creation_data
=
db
.
Column
(
db
.
DateTime
(),
default
=
datetime
.
utcnow
)
description
=
db
.
Column
(
db
.
String
(
64
))
title
=
db
.
Column
(
db
.
String
(
32
))
user_id
=
db
.
Column
(
db
.
Integer
,
db
.
ForeignKey
(
'
users.id
'
))
...
...
This diff is collapsed.
Click to expand it.
migrations/versions/c425353fb4dc_add_creation_data_to_corpus.py
0 → 100644
+
28
−
0
View file @
65becc11
"""
Add creation_data to corpus
Revision ID: c425353fb4dc
Revises: 3f2aee5e6a45
Create Date: 2019-08-06 15:38:33.930052
"""
from
alembic
import
op
import
sqlalchemy
as
sa
# revision identifiers, used by Alembic.
revision
=
'
c425353fb4dc
'
down_revision
=
'
3f2aee5e6a45
'
branch_labels
=
None
depends_on
=
None
def
upgrade
():
# ### commands auto generated by Alembic - please adjust! ###
op
.
add_column
(
'
corpora
'
,
sa
.
Column
(
'
creation_data
'
,
sa
.
DateTime
(),
nullable
=
True
))
# ### end Alembic commands ###
def
downgrade
():
# ### commands auto generated by Alembic - please adjust! ###
op
.
drop_column
(
'
corpora
'
,
'
creation_data
'
)
# ### end Alembic commands ###
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