diff options
-rw-r--r-- | certificate/models.py | 2 | ||||
-rw-r--r-- | certificate/views.py | 8 |
2 files changed, 7 insertions, 3 deletions
diff --git a/certificate/models.py b/certificate/models.py index 5f89e06..bc531b0 100644 --- a/certificate/models.py +++ b/certificate/models.py @@ -26,6 +26,8 @@ class Certificate(models.Model): email = models.CharField(max_length=50, null=True, blank=True) serial_no = models.CharField(max_length=50) #purpose+uin+1stletter counter = models.IntegerField() + workshop = models.CharField(max_length=100, null=True, blank=True) + paper = models.CharField(max_length=100, null=True, blank=True) class Scilab_participant(models.Model): ''' Autogenerated model file csvimport Mon Dec 1 07:46:00 2014 ''' diff --git a/certificate/views.py b/certificate/views.py index ddab500..a28c184 100644 --- a/certificate/views.py +++ b/certificate/views.py @@ -74,7 +74,7 @@ def download(request): except Certificate.DoesNotExist: certificate = create_certificate(certificate_path, name, qrcode, type, paper, workshop) if not certificate[1]: - certi_obj = Certificate(name=name, email=email, serial_no=serial_no, counter=1) + certi_obj = Certificate(name=name, email=email, serial_no=serial_no, counter=1, workshop=workshop, paper=paper) certi_obj.save() return certificate[0] @@ -96,13 +96,15 @@ def verify(request): return HttpResponse('Invalid Serial Number') else: name = certificate.name + paper = certificate.paper + workshop = certificate.workshop purpose, year, type = _get_detail(serial_no) if type == 'P': detail = '{0} had attended {1} {2}'.format(name, purpose, year) elif type == 'A': - detail = '{0} had presented paper in the {1} {2}'.format(name, purpose, year) + detail = '{0} had presented paper on {3} in the {1} {2}'.format(name, purpose, year, paper) elif type == 'W': - detail = '{0} had attended workshop in the {1} {2}'.format(name, purpose, year) + detail = '{0} had attended workshop on {3} in the {1} {2}'.format(name, purpose, year, workshop) context['detail'] = detail return render_to_response('verify.html', context, ci) return render_to_response('verify.html',{}, ci) |