Making my own coles gift card tracker app,
I needed to generate a barcode programmatically. I needed what Stocard generates which was found to be 'code128'. This barcode class is also the default in JsBarcode for javascript.
First, I tried to generate a barcode in django with above python code. This required extra field in the django model to track barcode file, and worse I had to deal with static/media files. This happened to be non-trivial.
As barcode can be easily generated on the frontend. I switched to generate with javascript code inside the django template.