summaryrefslogtreecommitdiff
path: root/yaksh/models.py
diff options
context:
space:
mode:
authorPalaparthy Adityachandra2021-03-24 17:33:47 +0530
committerGitHub2021-03-24 17:33:47 +0530
commit9cf0dd7abed0db01a676f731f69c3c63026bc2a3 (patch)
treea06ee2c94e07b0f8da7616781a909d6314ec6e20 /yaksh/models.py
parent2d9cf8d7d8b3f70806a115601d0a89a8a032b1dd (diff)
parentc6e440f6e04a3fd5fe1e086d300bfc8602562dbf (diff)
downloadonline_test-0.31.1.tar.gz
online_test-0.31.1.tar.bz2
online_test-0.31.1.zip
Merge pull request #828 from adityacp/fix_qrcodev0.31.1
Fix in QR code generation
Diffstat (limited to 'yaksh/models.py')
-rw-r--r--yaksh/models.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/yaksh/models.py b/yaksh/models.py
index 8f9f051..aa7c38d 100644
--- a/yaksh/models.py
+++ b/yaksh/models.py
@@ -3368,8 +3368,10 @@ class QRcode(models.Model):
os.makedirs(qr_dir)
path = os.path.join(qr_dir, f'{self.short_key}.png')
img.save(path)
- self.image = os.path.join('qrcode', '{0}.png'.format(self.short_key))
- self.activate()
+ with open(path, "rb") as qr_file:
+ django_file = File(qr_file)
+ self.activate()
+ self.image.save(os.path.basename(path), django_file, save=True)
class QRcodeHandler(models.Model):