summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPalaparthy Adityachandra2021-03-24 17:33:47 +0530
committerGitHub2021-03-24 17:33:47 +0530
commit9cf0dd7abed0db01a676f731f69c3c63026bc2a3 (patch)
treea06ee2c94e07b0f8da7616781a909d6314ec6e20
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
-rw-r--r--CHANGELOG.txt4
-rw-r--r--online_test/__init__.py2
-rw-r--r--yaksh/models.py6
-rw-r--r--yaksh/templates/yaksh/question.html8
-rw-r--r--yaksh/views.py1
5 files changed, 10 insertions, 11 deletions
diff --git a/CHANGELOG.txt b/CHANGELOG.txt
index 0d6d2b7..4abd14d 100644
--- a/CHANGELOG.txt
+++ b/CHANGELOG.txt
@@ -1,3 +1,7 @@
+=== 0.31.1 (24-03-2021) ===
+
+* Add support for QR code generation in local or S3 storage
+
=== 0.31.0 (24-03-2021) ===
* Add support for S3 file upload.
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 }}";
<br />
<div class="row">
<div class="col-md-8">
- <p>Upload assignment file for the said question.
- <br>
- <span class="badge badge-primary">
- </u> <strong>You can upload using the file browser below or via the QR code.</strong></u>
- </span>
- </p>
<div class="dropzone needsclick dz-clickable" id="dropzone_file">
<div class="dz-message needsclick">
<button type="button" class="dz-button">
- Drop files here or click to upload.
+ You can upload using the file browser here or via the QR code.
</button>
</div>
</div>
diff --git a/yaksh/views.py b/yaksh/views.py
index d2aa319..cad6d82 100644
--- a/yaksh/views.py
+++ b/yaksh/views.py
@@ -4163,7 +4163,6 @@ def generate_qrcode(request, answerpaper_id, question_id, module_id):
reverse("yaksh:upload_file", args=[qrcode.short_key])
)
qrcode.generate_image(content)
- qrcode.save()
return redirect(
reverse(
'yaksh:skip_question',