Add new field to dict method. Always keep in mind to do this, when you or modify a field.

This commit is contained in:
Patrick Jentsch 2020-04-30 11:32:48 +02:00
parent f87fe589c1
commit 08b909b9a8

View File

@ -443,8 +443,8 @@ class Corpus(db.Model):
user_id = db.Column(db.Integer, db.ForeignKey('users.id'))
# Fields
creation_date = db.Column(db.DateTime(), default=datetime.utcnow)
last_edited_date = db.Column(db.DateTime(), default=datetime.utcnow)
description = db.Column(db.String(255))
last_edited_date = db.Column(db.DateTime(), default=datetime.utcnow)
status = db.Column(db.String(16))
title = db.Column(db.String(32))
# Relationships
@ -457,6 +457,7 @@ class Corpus(db.Model):
'creation_date': self.creation_date.timestamp(),
'description': self.description,
'status': self.status,
'last_edited_date': self.last_edited_date.timestamp(),
'title': self.title,
'files': {file.id: file.to_dict() for file in self.files}}