From 8233efece2f49f7cf91fd84db05474726615fd8e Mon Sep 17 00:00:00 2001 From: prathamesh Date: Tue, 9 Dec 2014 14:37:15 +0530 Subject: Added text at the bottom of the certificate. Added javascript and modified view to handle multiple papers or workshop by one participant. --- certificate/certificate_template/text.png | Bin 0 -> 7026 bytes certificate/templates/download.html | 15 ++++++++++++--- certificate/views.py | 8 +++++--- 3 files changed, 17 insertions(+), 6 deletions(-) create mode 100644 certificate/certificate_template/text.png diff --git a/certificate/certificate_template/text.png b/certificate/certificate_template/text.png new file mode 100644 index 0000000..307708b Binary files /dev/null and b/certificate/certificate_template/text.png differ diff --git a/certificate/templates/download.html b/certificate/templates/download.html index bd0a2ac..7e6a14c 100644 --- a/certificate/templates/download.html +++ b/certificate/templates/download.html @@ -24,6 +24,7 @@   Workshop
+
{% if user_papers %}

Papers presented

@@ -31,15 +32,19 @@ {{ user.paper }}
{% endfor %}
- {% endif %} - {% if workshops %} + {% endif %} +
+
+ {% if workshops %}

Workshop Attended

{% for user in workshops %} {{ user.workshops }}
{% endfor %}
- {% endif %} + {% endif %} + +
@@ -67,6 +72,10 @@ if(notreg == "1"){ $("#invalidModal").modal(); } + $("[name=type]").change(function(){ + $("#paper").remove(); + $("#workshop").remove(); + }); }); {% endblock %} diff --git a/certificate/views.py b/certificate/views.py index 5ab2910..e9324b4 100644 --- a/certificate/views.py +++ b/certificate/views.py @@ -31,7 +31,8 @@ def download(request): elif type == 'A': if paper: user = Scilab_speaker.objects.filter(email=email, paper=paper) - user = [user[0]] + if user: + user = [user[0]] else: user = Scilab_speaker.objects.filter(email=email) if not user: @@ -47,7 +48,8 @@ def download(request): elif type == 'W': if workshop: user = Scilab_workshop.objects.filter(email=email, workshops=workshop) - user = [user[0]] + if user: + user = [user[0]] else: user = Scilab_workshop.objects.filter(email=email) if not user: @@ -66,7 +68,7 @@ def download(request): id = int(user.id) hexa = hex(id).replace('0x','').zfill(6).upper() serial_no = '{0}{1}{2}{3}'.format(purpose, year, hexa, type) - qrcode = '{0}\n{1}'.format(name, serial_no) + qrcode = 'NAME: {0} SERIAL NO: {1}'.format(name, serial_no) file_name = '{0}{1}'.format(email,id) file_name = file_name.replace('.', '') try: -- cgit