mirror of
				https://gitlab.ub.uni-bielefeld.de/sfb1288inf/nopaque.git
				synced 2025-11-03 20:02:47 +00:00 
			
		
		
		
	Add creation_data to corpus.
This commit is contained in:
		@@ -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'))
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user