16 lines
507 B
Python
16 lines
507 B
Python
from .attributes import AttributeWriterFactory
|
|
from models import ProductBarcode, BarcodeTemplate, BarcodeTemplateAttribute
|
|
|
|
|
|
class Barcode:
|
|
def __init__(self, session, barcode: ProductBarcode):
|
|
self.session = session
|
|
self.barcode = barcode
|
|
|
|
def render(self, template: BarcodeTemplate):
|
|
for attribute in template.attributes:
|
|
attribute: BarcodeTemplateAttribute
|
|
writer = AttributeWriterFactory.get_writer(attribute.key)
|
|
writer.write(self)
|
|
|