Skip to content

Commit

Permalink
Merge pull request #828 from adityacp/fix_qrcode
Browse files Browse the repository at this point in the history
Fix in QR code generation
  • Loading branch information
adityacp authored Mar 24, 2021
2 parents 2d9cf8d + c6e440f commit 9cf0dd7
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 11 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.txt
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
2 changes: 1 addition & 1 deletion online_test/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@

__all__ = ('celery_app',)

__version__ = '0.30.0'
__version__ = '0.31.1'
6 changes: 4 additions & 2 deletions yaksh/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -3368,8 +3368,10 @@ def generate_image(self, content):
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):
Expand Down
8 changes: 1 addition & 7 deletions yaksh/templates/yaksh/question.html
Original file line number Diff line number Diff line change
Expand Up @@ -284,16 +284,10 @@ <h4><u> Solution by teacher</u></h4>
<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>
Expand Down
1 change: 0 additions & 1 deletion yaksh/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down

0 comments on commit 9cf0dd7

Please sign in to comment.