Added a missing foreign key to Film on FilmFormat Model
This commit is contained in:
parent
999fea97a7
commit
316b54a686
|
|
@ -9,7 +9,9 @@ class Film(db.Model):
|
|||
ISO = db.Column(db.String(10))
|
||||
Push_Pull = db.Column(db.String(10))
|
||||
fk_FilmManufacturer_id = db.Column(db.Integer(),db.ForeignKey("film_manufacturer.id"))
|
||||
fk_FilmFormat_id = db.Column(db.Integer(),db.ForeignKey("film_format.id"))
|
||||
filmmanufacturer = db.relationship("FilmManufacturer",back_populates='films')
|
||||
filmformat = db.relationship("FilmFormat", back_populates='films' )
|
||||
def toDict(self):
|
||||
return {
|
||||
c.key: getattr(self,c.key) for c in inspect(self).mapper.column_attrs
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ from ..app import db
|
|||
class FilmFormat(db.Model):
|
||||
id = db.Column(db.Integer(),primary_key=True,nullable=False,unique=True, autoincrement=True)
|
||||
name = db.Column(db.String(255))
|
||||
|
||||
films = db.relationship("Film",back_populates='filmformat')
|
||||
def toDict(self):
|
||||
return {
|
||||
c.key: getattr(self,c.key) for c in inspect(self).mapper.column_attrs
|
||||
|
|
|
|||
|
|
@ -8,14 +8,14 @@ from .config import config
|
|||
|
||||
|
||||
db = SQLAlchemy()
|
||||
migrate = Migrate()
|
||||
migrate = Migrate(render_as_batch=True)
|
||||
|
||||
def create_app(config_mode):
|
||||
app = Flask(__name__)
|
||||
app.config.from_object(config[config_mode])
|
||||
|
||||
db.init_app(app)
|
||||
migrate.init_app(app,db,render_as_batch=True)
|
||||
migrate.init_app(app,db,)
|
||||
|
||||
with app.app_context():
|
||||
@event.listens_for(db.engine, 'connect')
|
||||
|
|
|
|||
Loading…
Reference in New Issue