Clean up Product
model code a bit
This commit is contained in:
parent
874ba69813
commit
3d6ee12c0f
|
@ -106,11 +106,6 @@ class Family(Base):
|
|||
code = sa.Column(sa.Integer())
|
||||
name = sa.Column(sa.String(length=50))
|
||||
|
||||
products = relationship(
|
||||
u'Product', back_populates=u'family', doc=u"""\
|
||||
Collection of :class:`Product` instances which associate with this family.
|
||||
""")
|
||||
|
||||
def __unicode__(self):
|
||||
return unicode(self.name or '')
|
||||
|
||||
|
@ -129,11 +124,6 @@ class ReportCode(Base):
|
|||
code = sa.Column(sa.Integer(), nullable=False)
|
||||
name = sa.Column(sa.String(length=100), nullable=True)
|
||||
|
||||
products = relationship(
|
||||
u'Product', back_populates=u'report_code', doc=u"""\
|
||||
Collection of :class:`Product` instances which associate with this report code.
|
||||
""")
|
||||
|
||||
def __unicode__(self):
|
||||
if not self.code:
|
||||
return ''
|
||||
|
|
|
@ -195,10 +195,11 @@ UTC timestamp of the product's last sale event.
|
|||
subdepartment = orm.relationship(
|
||||
Subdepartment,
|
||||
order_by=Subdepartment.name,
|
||||
backref=orm.backref('products', cascade='all'))
|
||||
backref=orm.backref('products'))
|
||||
|
||||
category = orm.relationship(
|
||||
Category, back_populates='products')
|
||||
Category,
|
||||
backref=orm.backref('products'))
|
||||
|
||||
brand = orm.relationship(Brand)
|
||||
|
||||
|
@ -208,7 +209,11 @@ UTC timestamp of the product's last sale event.
|
|||
Reference to the :class:`Family` instance with which the product
|
||||
associates, if any.
|
||||
""",
|
||||
back_populates='products')
|
||||
backref=orm.backref(
|
||||
'products',
|
||||
doc="""
|
||||
List of :class:`Product` objects which belong to this family.
|
||||
"""))
|
||||
|
||||
report_code = orm.relationship(
|
||||
'ReportCode',
|
||||
|
@ -216,7 +221,11 @@ UTC timestamp of the product's last sale event.
|
|||
Reference to the :class:`ReportCode` instance with which the product
|
||||
associates, if any.
|
||||
""",
|
||||
back_populates='products')
|
||||
backref=orm.backref(
|
||||
'products',
|
||||
doc="""
|
||||
List of :class:`Product` objects which associate with this report code.
|
||||
"""))
|
||||
|
||||
def __unicode__(self):
|
||||
return self.full_description
|
||||
|
@ -250,10 +259,6 @@ UTC timestamp of the product's last sale event.
|
|||
return cost
|
||||
|
||||
|
||||
Category.products = orm.relationship(
|
||||
Product, back_populates='category')
|
||||
|
||||
|
||||
class ProductCode(Base):
|
||||
"""
|
||||
Represents an arbitrary "code" for a product.
|
||||
|
|
Loading…
Reference in a new issue