mirror of
https://gitlab.ub.uni-bielefeld.de/sfb1288inf/nopaque.git
synced 2024-11-15 01:05:42 +00:00
Add creation_data to corpus.
This commit is contained in:
parent
32c6b9ab8a
commit
65becc1187
@ -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'],
|
||||
|
@ -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'))
|
||||
|
@ -0,0 +1,28 @@
|
||||
"""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 ###
|
Loading…
Reference in New Issue
Block a user