fixed bug with route to / now needing to be to base.html, not main.html, then just added publisher (list all/edit 1/deleted button)

This commit is contained in:
2020-11-14 15:33:43 +11:00
parent 3831c0a03b
commit 29f8189c97
5 changed files with 113 additions and 9 deletions

17
main.py
View File

@@ -16,6 +16,7 @@ ma = Marshmallow(app)
Bootstrap(app)
from author import Author, AuthorForm, AuthorSchema
from publisher import Publisher, PublisherForm, PublisherSchema
####################################### CLASSES / DB model #######################################
book_author_link = db.Table('book_author_link', db.Model.metadata,
@@ -64,12 +65,12 @@ class Book(db.Model):
def __repr__(self):
return "<id: {}, author: {}, title: {}, year_published: {}, rating: {}, condition: {}, owned: {}, covertype: {}, notes: {}, blurb: {}, created: {}, modified: {}, publisher: {}>".format(self.id, self.author, self.title, self.year_published, self.rating, self.condition, self.owned, self.covertype, self.notes, self.blurb, self.created, self.modified, self.publisher )
class Publisher(db.Model):
id = db.Column(db.Integer, unique=True, nullable=False, primary_key=True)
name = db.Column(db.String(50), unique=False, nullable=False)
def __repr__(self):
return "<id: {}, name: {}>".format(self.id, self.name)
#$class Publisher(db.Model):
# id = db.Column(db.Integer, unique=True, nullable=False, primary_key=True)
# name = db.Column(db.String(50), unique=False, nullable=False)
#
# def __repr__(self):
# return "<id: {}, name: {}>".format(self.id, self.name)
class Genre_Lst(db.Model):
__tablename__ = "genre_lst"
@@ -79,8 +80,8 @@ class Genre_Lst(db.Model):
def __repr__(self):
return "<id: {}, genre: {}>".format(self.id, self.genre)
class PublisherSchema(ma.SQLAlchemyAutoSchema):
class Meta: model = Publisher
#class PublisherSchema(ma.SQLAlchemyAutoSchema):
# class Meta: model = Publisher
class Genre_LstSchema(ma.SQLAlchemyAutoSchema):
class Meta: model = Genre_Lst