feat: temp barcode templates
This commit is contained in:
		
							
								
								
									
										15
									
								
								barcodes/barcode.py
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										15
									
								
								barcodes/barcode.py
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,15 @@
 | 
			
		||||
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)
 | 
			
		||||
 | 
			
		||||
		Reference in New Issue
	
	Block a user