|
|
|
@ -9,12 +9,16 @@ class Book(db.Model):
|
|
|
|
|
cover = db.Column(db.String(255))
|
|
|
|
|
fileformat = db.Column(db.String(255))
|
|
|
|
|
author = db.relationship('Author')
|
|
|
|
|
tag = db.Column(db.String(255))
|
|
|
|
|
|
|
|
|
|
def __init__(self, title, file, cover, fileformat, tag):
|
|
|
|
|
|
|
|
|
|
def __init__(self, title, file, cover, fileformat):
|
|
|
|
|
self.title = title
|
|
|
|
|
self.file = file
|
|
|
|
|
self.cover = cover
|
|
|
|
|
self.fileformat = fileformat
|
|
|
|
|
self.tag = tag
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def __repr__(self):
|
|
|
|
|
return '<Title %r>' % self.title
|
|
|
|
@ -40,7 +44,8 @@ class BookSchema(Schema):
|
|
|
|
|
file = fields.Str()
|
|
|
|
|
cover = fields.Str()
|
|
|
|
|
fileformat = fields.Str()
|
|
|
|
|
tag = fields.Str()
|
|
|
|
|
|
|
|
|
|
def must_not_be_blank(data):
|
|
|
|
|
if not data:
|
|
|
|
|
raise ValidationError('Data not provided.')
|
|
|
|
|
raise ValidationError('You forgot to write stuff.')
|
|
|
|
|