diff --git a/main.py b/main.py index 192cd02..005010d 100644 --- a/main.py +++ b/main.py @@ -91,16 +91,14 @@ class Genre_LstSchema(ma.SQLAlchemyAutoSchema): class BookSchema(ma.SQLAlchemyAutoSchema): author = ma.Nested(AuthorSchema, many=True) - publisher = ma.Nested(PublisherSchema) + publisher = ma.Nested(PublisherSchema, many=True) + genre = ma.Nested(Genre_LstSchema, many=True) class Meta: model = Book include_relationships = True load_instance = True ### DDP: do I need many=True on Author as books have many authors? (or in BookSchema declaration above?) -author_schema = AuthorSchema(many=True) -publisher_schema = PublisherSchema() -genre_schema = Genre_LstSchema(many=True) book_schema = BookSchema() ####################################### ROUTES ####################################### diff --git a/templates/books.html b/templates/books.html index e166e61..9af902f 100644 --- a/templates/books.html +++ b/templates/books.html @@ -44,36 +44,42 @@ {% else %} -