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