Fix code for creation_date in corpus object.

This commit is contained in:
Patrick Jentsch 2019-08-06 15:46:23 +02:00
parent b255f3bb4a
commit 59016be061
3 changed files with 8 additions and 35 deletions

View File

@ -29,8 +29,8 @@ def dashboard():
app = current_app._get_current_object()
corpus = Corpus()
corpus.creation_date = datetime.utcnow()
corpus.description = create_corpus_form.description.data,
corpus.title = create_corpus_form.title.data,
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()

View File

@ -1,28 +0,0 @@
"""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 ###

View File

@ -1,8 +1,8 @@
"""Initial migrate
"""initial migrate
Revision ID: 3f2aee5e6a45
Revision ID: f148de896c56
Revises:
Create Date: 2019-08-06 14:29:59.814876
Create Date: 2019-08-06 15:42:19.487064
"""
from alembic import op
@ -10,7 +10,7 @@ import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '3f2aee5e6a45'
revision = 'f148de896c56'
down_revision = None
branch_labels = None
depends_on = None
@ -30,9 +30,9 @@ def upgrade():
op.create_table('users',
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('confirmed', sa.Boolean(), nullable=True),
sa.Column('registration_date', sa.DateTime(), nullable=True),
sa.Column('email', sa.String(length=64), nullable=True),
sa.Column('password_hash', sa.String(length=128), nullable=True),
sa.Column('registration_date', sa.DateTime(), nullable=True),
sa.Column('role_id', sa.Integer(), nullable=True),
sa.Column('username', sa.String(length=64), nullable=True),
sa.ForeignKeyConstraint(['role_id'], ['roles.id'], ),
@ -42,6 +42,7 @@ def upgrade():
op.create_index(op.f('ix_users_username'), 'users', ['username'], unique=True)
op.create_table('corpora',
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('creation_date', sa.DateTime(), nullable=True),
sa.Column('description', sa.String(length=64), nullable=True),
sa.Column('title', sa.String(length=32), nullable=True),
sa.Column('user_id', sa.Integer(), nullable=True),