mirror of
https://gitlab.ub.uni-bielefeld.de/sfb1288inf/nopaque.git
synced 2024-12-24 10:34:17 +00:00
Add corpus model.
This commit is contained in:
parent
ebba2913f8
commit
46b8550c65
@ -111,6 +111,7 @@ class User(UserMixin, db.Model):
|
||||
role_id = db.Column(db.Integer, db.ForeignKey('roles.id'))
|
||||
username = db.Column(db.String(64), unique=True, index=True)
|
||||
# Relationships
|
||||
corpora = db.relationship('Corpus', backref='corpus', lazy='dynamic')
|
||||
jobs = db.relationship('Job', backref='job', lazy='dynamic')
|
||||
|
||||
def __repr__(self):
|
||||
@ -247,6 +248,27 @@ class Job(db.Model):
|
||||
return '<Job %r>' % self.title
|
||||
|
||||
|
||||
class Corpus(db.Model):
|
||||
"""
|
||||
Class to define a corpus.
|
||||
"""
|
||||
__tablename__ = 'corpora'
|
||||
# Primary key
|
||||
id = db.Column(db.Integer, primary_key=True)
|
||||
description = db.Column(db.String(64))
|
||||
title = db.Column(db.String(32))
|
||||
user_id = db.Column(db.Integer, db.ForeignKey('users.id'))
|
||||
|
||||
def __init__(self, **kwargs):
|
||||
super(Job, self).__init__(**kwargs)
|
||||
|
||||
def __repr__(self):
|
||||
"""
|
||||
String representation of the corpus. For human readability.
|
||||
"""
|
||||
return '<Corpus %r>' % self.title
|
||||
|
||||
|
||||
'''
|
||||
' Flask-Login is told to use the application’s custom anonymous user by setting
|
||||
' its class in the login_manager.anonymous_user attribute.
|
||||
|
Loading…
Reference in New Issue
Block a user