This commit is contained in:
2024-05-09 01:32:37 +03:00
parent 3e83cf6f92
commit 61d27d2389
16 changed files with 179 additions and 115 deletions

View File

@@ -33,18 +33,26 @@ class DealProduct(BaseModel):
quantity = Column(Integer, nullable=False, comment='Кол-во продукта')
class BarcodeTemplateAttributeLink(BaseModel):
__tablename__ = 'barcode_template_attributes_links'
barcode_template_id = Column(Integer,
ForeignKey('barcode_templates.id'),
nullable=False,
comment='ID Шаблона ШК',
primary_key=True)
barcode_template = relationship('BarcodeTemplate', back_populates='attributes')
attribute_id = Column(Integer,
ForeignKey('barcode_template_attributes.id'),
nullable=False,
comment='ID Атрибута',
primary_key=True)
attribute = relationship('BarcodeTemplateAttribute')
# class BarcodeTemplateAttributeLink(BaseModel):
# __tablename__ = 'barcode_template_attributes_links'
# barcode_template_id = Column(Integer,
# ForeignKey('barcode_templates.id'),
# nullable=False,
# comment='ID Шаблона ШК',
# primary_key=True)
# barcode_template = relationship('BarcodeTemplate',
# # back_populates='attributes'
# )
#
# attribute_id = Column(Integer,
# ForeignKey('barcode_template_attributes.id'),
# nullable=False,
# comment='ID Атрибута',
# primary_key=True)
# attribute = relationship('BarcodeTemplateAttribute')
barcode_template_attribute_link = Table(
'barcode_template_attribute_links',
BaseModel.metadata,
Column('barcode_template_id', ForeignKey('barcode_templates.id')),
Column('attribute_id', ForeignKey('barcode_template_attributes.id'))
)