diff options
author | adityacp | 2021-03-24 17:30:04 +0530 |
---|---|---|
committer | adityacp | 2021-03-24 17:30:04 +0530 |
commit | a50729c6c1a7cb3309ca6c695a075f2c90a517d2 (patch) | |
tree | 050752926c05d452d1a73a4c93369e27032716d0 /yaksh/models.py | |
parent | 2d9cf8d7d8b3f70806a115601d0a89a8a032b1dd (diff) | |
download | online_test-a50729c6c1a7cb3309ca6c695a075f2c90a517d2.tar.gz online_test-a50729c6c1a7cb3309ca6c695a075f2c90a517d2.tar.bz2 online_test-a50729c6c1a7cb3309ca6c695a075f2c90a517d2.zip |
Fix qr code save error
Diffstat (limited to 'yaksh/models.py')
-rw-r--r-- | yaksh/models.py | 6 |
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): |