mirror of
				https://gitlab.ub.uni-bielefeld.de/sfb1288inf/nopaque.git
				synced 2025-10-31 02:32:45 +00:00 
			
		
		
		
	Add corpus model.
This commit is contained in:
		| @@ -111,6 +111,7 @@ class User(UserMixin, db.Model): | |||||||
|     role_id = db.Column(db.Integer, db.ForeignKey('roles.id')) |     role_id = db.Column(db.Integer, db.ForeignKey('roles.id')) | ||||||
|     username = db.Column(db.String(64), unique=True, index=True) |     username = db.Column(db.String(64), unique=True, index=True) | ||||||
|     # Relationships |     # Relationships | ||||||
|  |     corpora = db.relationship('Corpus', backref='corpus', lazy='dynamic') | ||||||
|     jobs = db.relationship('Job', backref='job', lazy='dynamic') |     jobs = db.relationship('Job', backref='job', lazy='dynamic') | ||||||
|  |  | ||||||
|     def __repr__(self): |     def __repr__(self): | ||||||
| @@ -247,6 +248,27 @@ class Job(db.Model): | |||||||
|         return '<Job %r>' % self.title |         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 | ' Flask-Login is told to use the application’s custom anonymous user by setting | ||||||
| ' its class in the login_manager.anonymous_user attribute. | ' its class in the login_manager.anonymous_user attribute. | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user