From 78317b927252f707ef064e4f1817144ce9c4b181 Mon Sep 17 00:00:00 2001 From: Lance Edgar Date: Thu, 18 Jul 2019 09:43:40 -0500 Subject: [PATCH] Rename vendor model attributes, to be more pythonic --- corepos/db/model.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/corepos/db/model.py b/corepos/db/model.py index c14c20c..9a03c0c 100644 --- a/corepos/db/model.py +++ b/corepos/db/model.py @@ -105,13 +105,13 @@ class Vendor(Base): """ __tablename__ = 'vendors' - vendorID = sa.Column(sa.Integer(), primary_key=True, autoincrement=False, nullable=False) + id = sa.Column('vendorID', sa.Integer(), primary_key=True, autoincrement=False, nullable=False) - vendorName = sa.Column(sa.String(length=50), nullable=True) + name = sa.Column('vendorName', sa.String(length=50), nullable=True) - vendorAbbreviation = sa.Column(sa.String(length=10), nullable=True) + abbreviation = sa.Column('vendorAbbreviation', sa.String(length=10), nullable=True) - discountRate = sa.Column(sa.Float(), nullable=True) + discount_rate = sa.Column('discountRate', sa.Float(), nullable=True) contact = orm.relationship( 'VendorContact', @@ -140,7 +140,7 @@ class Vendor(Base): creator=lambda n: VendorContact(notes=n)) def __str__(self): - return self.vendorName or '' + return self.name or '' class VendorContact(Base): @@ -149,7 +149,7 @@ class VendorContact(Base): """ __tablename__ = 'vendorContact' - vendorID = sa.Column(sa.Integer(), sa.ForeignKey('vendors.vendorID'), primary_key=True, autoincrement=False, nullable=False) + vendor_id = sa.Column('vendorID', sa.Integer(), sa.ForeignKey('vendors.vendorID'), primary_key=True, autoincrement=False, nullable=False) phone = sa.Column(sa.String(length=15), nullable=True) @@ -264,7 +264,7 @@ class Product(Base): vendor = orm.relationship( Vendor, - primaryjoin=Vendor.vendorID == default_vendor_id, + primaryjoin=Vendor.id == default_vendor_id, foreign_keys=[default_vendor_id], doc=""" Reference to the default :class:`Vendor` from which the product is obtained.