|
@@ -1,6 +1,13 @@
|
|
-from barcode import EAN13
|
|
|
|
|
|
+from barcode import EAN13, Code128
|
|
|
|
+
|
|
|
|
+BARCODE_MAP = {
|
|
|
|
+ 'EAN_13': EAN13,
|
|
|
|
+ 'CODE_128': Code128,
|
|
|
|
+}
|
|
|
|
|
|
def get_bar_code(meta):
|
|
def get_bar_code(meta):
|
|
- if meta['format'] == 'EAN_13':
|
|
|
|
|
|
+ f = BARCODE_MAP.get(meta['format'], None)
|
|
|
|
+ if f is not None:
|
|
return EAN13(meta['content']).render()
|
|
return EAN13(meta['content']).render()
|
|
|
|
+
|
|
return None
|
|
return None
|