From a50729c6c1a7cb3309ca6c695a075f2c90a517d2 Mon Sep 17 00:00:00 2001
From: adityacp
Date: Wed, 24 Mar 2021 17:30:04 +0530
Subject: Fix qr code save error
---
online_test/__init__.py | 2 +-
yaksh/models.py | 6 ++++--
yaksh/templates/yaksh/question.html | 8 +-------
yaksh/views.py | 1 -
4 files changed, 6 insertions(+), 11 deletions(-)
diff --git a/online_test/__init__.py b/online_test/__init__.py
index 09a303b..1268e1a 100644
--- a/online_test/__init__.py
+++ b/online_test/__init__.py
@@ -4,4 +4,4 @@ from online_test.celery_settings import app as celery_app
__all__ = ('celery_app',)
-__version__ = '0.30.0'
+__version__ = '0.31.1'
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):
diff --git a/yaksh/templates/yaksh/question.html b/yaksh/templates/yaksh/question.html
index f8f0c46..9fe57ed 100644
--- a/yaksh/templates/yaksh/question.html
+++ b/yaksh/templates/yaksh/question.html
@@ -284,16 +284,10 @@ question_type = "{{ question.type }}";
Upload assignment file for the said question.
-
-
- You can upload using the file browser below or via the QR code.
-
-