Closed softwareEng92 closed 4 years ago
Dear i need your code can you send me Bilalamjad837@gmail.com
I would either save the path in the database or store the image in the database.
To store the path just add a string to your model, if you want to save the image you can save the binary image bu first saving it to a buffer and get the binary data.
img = qrcode.make("Some text")
buf = io.BytesIO()
img.save(buf, "PNG")
contents = buf.getvalue()
Good answer, @thommath (and this isn't really a core issue, so closing)
I created a table for products and its have an ImageField like this:
productQrImage = models.ImageField(upload_to='media/', blank=True, null=True)
and that is my code for generate a qrcode and it takes product name (as you can see down). its save png file to media its ok but I need to save it to database and than retrieve to product list page. I search for this about two days I haven't find any solution.