From 4adebd33905a717d68454c8bb306f1944c85c091 Mon Sep 17 00:00:00 2001 From: Zhong Dai Date: Thu, 1 Mar 2018 13:00:37 +1100 Subject: [PATCH] remove the db. by using the alias --- .../{{cookiecutter.app_name}}/database.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/{{cookiecutter.app_name}}/{{cookiecutter.app_name}}/database.py b/{{cookiecutter.app_name}}/{{cookiecutter.app_name}}/database.py index f4edafa..3a8883d 100644 --- a/{{cookiecutter.app_name}}/{{cookiecutter.app_name}}/database.py +++ b/{{cookiecutter.app_name}}/{{cookiecutter.app_name}}/database.py @@ -49,7 +49,7 @@ class SurrogatePK(object): __table_args__ = {'extend_existing': True} - id = db.Column(db.Integer, primary_key=True) + id = Column(db.Integer, primary_key=True) @classmethod def get_by_id(cls, record_id): @@ -70,6 +70,6 @@ def reference_col(tablename, nullable=False, pk_name='id', **kwargs): category_id = reference_col('category') category = relationship('Category', backref='categories') """ - return db.Column( + return Column( db.ForeignKey('{0}.{1}'.format(tablename, pk_name)), nullable=nullable, **kwargs)