|
|
@ -6,12 +6,14 @@ class Book(db.Model): |
|
|
|
title = db.Column(db.String(255)) |
|
|
|
author = 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.author = author |
|
|
|
self.file = file |
|
|
|
self.tag = tag |
|
|
|
|
|
|
|
def __repr__(self): |
|
|
|
return '<Title %r>' % self.title |
|
|
@ -22,7 +24,8 @@ class BookSchema(Schema): |
|
|
|
title = fields.Str() |
|
|
|
author = fields.Str() |
|
|
|
file = 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.') |
|
|
|