diff options
author | komalsheth286 | 2016-12-13 10:38:09 +0530 |
---|---|---|
committer | komalsheth286 | 2016-12-13 10:38:09 +0530 |
commit | 4fdb3d90e9092dbd0b72faffe396e95b2ecefa81 (patch) | |
tree | f356362f1729acb553e49875f10cafa0ee89c276 | |
parent | 6c9c0cab6e43611411b8627e14c9a63eb2cd307e (diff) | |
download | certificate-generator-4fdb3d90e9092dbd0b72faffe396e95b2ecefa81.tar.gz certificate-generator-4fdb3d90e9092dbd0b72faffe396e95b2ecefa81.tar.bz2 certificate-generator-4fdb3d90e9092dbd0b72faffe396e95b2ecefa81.zip |
Changes is template
-rw-r--r--[-rwxr-xr-x] | certificate/scipy_template_2016/kannan-moudgalya-sign.png | bin | 19082 -> 79661 bytes | |||
-rwxr-xr-x[-rw-r--r--] | certificate/scipy_template_2016/template_SPC2016Acertificate | 96 | ||||
-rwxr-xr-x[-rw-r--r--] | certificate/scipy_template_2016/template_SPC2016Pcertificate | 86 | ||||
-rwxr-xr-x[-rw-r--r--] | certificate/scipy_template_2016/template_SPC2016Wcertificate | 86 | ||||
-rwxr-xr-x | certificate/views.py | 132 |
5 files changed, 287 insertions, 113 deletions
diff --git a/certificate/scipy_template_2016/kannan-moudgalya-sign.png b/certificate/scipy_template_2016/kannan-moudgalya-sign.png Binary files differindex 0f57874..6feda2d 100755..100644 --- a/certificate/scipy_template_2016/kannan-moudgalya-sign.png +++ b/certificate/scipy_template_2016/kannan-moudgalya-sign.png diff --git a/certificate/scipy_template_2016/template_SPC2016Acertificate b/certificate/scipy_template_2016/template_SPC2016Acertificate index 3371830..3c11489 100644..100755 --- a/certificate/scipy_template_2016/template_SPC2016Acertificate +++ b/certificate/scipy_template_2016/template_SPC2016Acertificate @@ -1,21 +1,85 @@ -* certificate template +%% Internship Certificate template +\documentclass[landscape]{article} +\usepackage{wallpaper} +\usepackage{niceframe} +\usepackage{xcolor} +\usepackage{ulem} +\usepackage{graphicx} +\usepackage{geometry} +\usepackage{chancery} +\usepackage[T1]{fontenc} +%% package to execute bash commands +%% \usepackage{bashful} -** Usage - - To generate a PDF file type, - #+BEGIN_SRC sh - make $command - #+END_SRC sh +%% generate QR code +\usepackage{pst-barcode} +\usepackage{auto-pst-pdf} - - To clean the project - #+BEGIN_SRC sh - make clean - #+END_SRC sh +\geometry{tmargin=.2cm,bmargin=.2cm, + lmargin=.2cm, rmargin=.2cm} +\usepackage{multicol} +\setlength{\columnseprule}{1pt} +\columnwidth=0.6\textwidth -** License - The tex file and all the images within this project are entirely - PRIVATE. It's usage outside the `Fossee Project` is an legal - offense and will be subject to suitable punishment by Indian law. +\begin{document} +%% create MD5 hash of tex file and insert it in PDF +%% \bash +%% md5sum asd_cert.tex | cut -d " " -f 1 +%% \END -** Website - [[http://fossee.in]] +%\TileWallPaper{4cm}{2cm}{aakash-logo.png} +\TileWallPaper{cer_bg.png} + +\centering +\scalebox{3} +{ +\color{green!30!black!60} +\begin{minipage}{.33\textwidth} +\font\border=umrandb + +{ + +\begin{center} +\vspace{2.3cm} +{\scriptsize \color{black} \hspace{2cm} This is to certify that } \\ +{\small {\color{black}\hspace{2cm}{$name}} }\\ +{\tiny {\color{black} \hspace{2cm} from the Department of speaker,\\ +\hspace{2cm} speaker,\\ +\hspace{2cm}has successfully completed an internship from speaker \\ +\hspace{2cm} in the Sponsored Project, FOSSEE (Free and Open Source Software for Education) at IIT Bombay.\\ +\vspace{.1cm} +\hspace{2cm} During this tenure, he/she had worked on \\ +\hspace{2cm} \color{red} speaker. \\ {\tiny{}} +}} +\end{center} + +\vspace{.2cm} +\begin{minipage}{.33\textwidth} +{\color{blue!40!black} \vspace{.2cm} +\scalebox{0.6}{ +\hspace{3cm} + \begin{tabular}{c c c} + \small{} & \small{\includegraphics[height=0.6cm]{kannan-moudgalya-sign.png}} &\\ + \small{} & \small{~~~~~~~~Prof. Kannan Moudgalya~~~~~~~~} &\\ + \small{} & \small{Project In-charge} &\\ + \end{tabular} +} +} +\end{minipage} +\hfill +\begin{minipage}{.33\textwidth} +\begin{centering} +\vspace{.2cm} +%%\includegraphics[height=0.6cm]{fossee_logo.png}\hspace{22pt} +%%\includegraphics[height=0.7cm]{iitb-logo.png}\hspace{22pt} +\begin{pspicture}(0.1cm,0.1cm) \psbarcode{$qr_code}{eclevel=L width=0.25 height=0.25}{qrcode}\end{pspicture}\\ +\tiny{\texttt{$serial_key}}\\ +\end{centering} +\end{minipage} + +} + +\end{minipage} +} +\end{document} diff --git a/certificate/scipy_template_2016/template_SPC2016Pcertificate b/certificate/scipy_template_2016/template_SPC2016Pcertificate index 3371830..081df5c 100644..100755 --- a/certificate/scipy_template_2016/template_SPC2016Pcertificate +++ b/certificate/scipy_template_2016/template_SPC2016Pcertificate @@ -1,21 +1,75 @@ -* certificate template +%% Certificate template +\documentclass[landscape]{article} +\usepackage{wallpaper} +\usepackage{xcolor} +\usepackage{ulem} +\usepackage{graphicx} +\usepackage{geometry} +\usepackage{chancery} +\usepackage[T1]{fontenc} +%% package to execute bash commands +%% \usepackage{bashful} -** Usage - - To generate a PDF file type, - #+BEGIN_SRC sh - make $command - #+END_SRC sh +%% generate QR code +\usepackage{pst-barcode} +\usepackage{auto-pst-pdf} - - To clean the project - #+BEGIN_SRC sh - make clean - #+END_SRC sh +\geometry{tmargin=.2cm,bmargin=.2cm, + lmargin=.2cm, rmargin=.2cm} +\usepackage{multicol} +\setlength{\columnseprule}{1pt} +\columnwidth=0.6\textwidth -** License - The tex file and all the images within this project are entirely - PRIVATE. It's usage outside the `Fossee Project` is an legal - offense and will be subject to suitable punishment by Indian law. +\begin{document} +%% create MD5 hash of tex file and insert it in PDF +%% \bash +%% md5sum asd_cert.tex | cut -d " " -f 1 +%% \END -** Website - [[http://fossee.in]] +%\TileWallPaper{4cm}{2cm}{aakash-logo.png} +\TileWallPaper{28cm}{22cm}{cer_bg.png} + +\centering +\scalebox{3}{\color{brown!30!brown!60} +\begin{minipage}{.33\textwidth} + + +{\centering + +%% logo - top +\vspace{1.5cm} +\textcolor{black}{\textsc{Certificate of Participation}} +\hspace{10cm} +\textcolor{black!100}{\scriptsize This is to certify that}\\ +{\textcolor{blue} {~~~~~~~~{$name}}~~~~~~~~}\\ +{\scriptsize {\color{black} Participated in SciPy India 2016\\ +organized by Indian Institute of Bombay \\ +on 10, 11 December 2016.}\\} + +\vspace{0.3cm} +{\color{black!40!black} +\scalebox{.7}{ + \begin{tabular}{c c c c c} + \small{\includegraphics[height=0.6cm]{kannan-moudgalya-sign.png}} & \small{} & & &\small{\includegraphics[height=0.6cm]{kannan-moudgalya-sign.png}} \\ + \small{Prof. Prabhu Ramachandran} & &\hspace{2.5cm} & & \small{~~~~~~~~Dr. Mr. S. Anand~~~~~~~~} \\ + \vspace{0mm} + {\scriptsize Conference Co-Chair} & & & & \scriptsize {Keynote Speaker} \\ + {\scriptsize FOSSEE, IIT Bombay.} & & & & \scriptsize {CEO Gramener} \\ + + \end{tabular} + +}} +\\ +\vspace{2mm} +%%\includegraphics[height=0.6cm]{fossee-logo.png}\hspace{22pt} +%%\includegraphics[height=0.7cm]{bottom_logo.png}\hspace{22pt} +%%\includegraphics[height=0.7cm]{iitb-logo.png}\hspace{22pt}\\ +\hspace{6.7cm}\begin{pspicture}(0.1cm,0.1cm) \psbarcode{$qr_code}{eclevel=L width=0.25 height=0.25}{qrcode}\end{pspicture}\\ +\hspace{6.7cm}\tiny{\color{black}\texttt{$serial_key}}\\ + +} + +\end{minipage} +} +\end{document} diff --git a/certificate/scipy_template_2016/template_SPC2016Wcertificate b/certificate/scipy_template_2016/template_SPC2016Wcertificate index 3371830..081df5c 100644..100755 --- a/certificate/scipy_template_2016/template_SPC2016Wcertificate +++ b/certificate/scipy_template_2016/template_SPC2016Wcertificate @@ -1,21 +1,75 @@ -* certificate template +%% Certificate template +\documentclass[landscape]{article} +\usepackage{wallpaper} +\usepackage{xcolor} +\usepackage{ulem} +\usepackage{graphicx} +\usepackage{geometry} +\usepackage{chancery} +\usepackage[T1]{fontenc} +%% package to execute bash commands +%% \usepackage{bashful} -** Usage - - To generate a PDF file type, - #+BEGIN_SRC sh - make $command - #+END_SRC sh +%% generate QR code +\usepackage{pst-barcode} +\usepackage{auto-pst-pdf} - - To clean the project - #+BEGIN_SRC sh - make clean - #+END_SRC sh +\geometry{tmargin=.2cm,bmargin=.2cm, + lmargin=.2cm, rmargin=.2cm} +\usepackage{multicol} +\setlength{\columnseprule}{1pt} +\columnwidth=0.6\textwidth -** License - The tex file and all the images within this project are entirely - PRIVATE. It's usage outside the `Fossee Project` is an legal - offense and will be subject to suitable punishment by Indian law. +\begin{document} +%% create MD5 hash of tex file and insert it in PDF +%% \bash +%% md5sum asd_cert.tex | cut -d " " -f 1 +%% \END -** Website - [[http://fossee.in]] +%\TileWallPaper{4cm}{2cm}{aakash-logo.png} +\TileWallPaper{28cm}{22cm}{cer_bg.png} + +\centering +\scalebox{3}{\color{brown!30!brown!60} +\begin{minipage}{.33\textwidth} + + +{\centering + +%% logo - top +\vspace{1.5cm} +\textcolor{black}{\textsc{Certificate of Participation}} +\hspace{10cm} +\textcolor{black!100}{\scriptsize This is to certify that}\\ +{\textcolor{blue} {~~~~~~~~{$name}}~~~~~~~~}\\ +{\scriptsize {\color{black} Participated in SciPy India 2016\\ +organized by Indian Institute of Bombay \\ +on 10, 11 December 2016.}\\} + +\vspace{0.3cm} +{\color{black!40!black} +\scalebox{.7}{ + \begin{tabular}{c c c c c} + \small{\includegraphics[height=0.6cm]{kannan-moudgalya-sign.png}} & \small{} & & &\small{\includegraphics[height=0.6cm]{kannan-moudgalya-sign.png}} \\ + \small{Prof. Prabhu Ramachandran} & &\hspace{2.5cm} & & \small{~~~~~~~~Dr. Mr. S. Anand~~~~~~~~} \\ + \vspace{0mm} + {\scriptsize Conference Co-Chair} & & & & \scriptsize {Keynote Speaker} \\ + {\scriptsize FOSSEE, IIT Bombay.} & & & & \scriptsize {CEO Gramener} \\ + + \end{tabular} + +}} +\\ +\vspace{2mm} +%%\includegraphics[height=0.6cm]{fossee-logo.png}\hspace{22pt} +%%\includegraphics[height=0.7cm]{bottom_logo.png}\hspace{22pt} +%%\includegraphics[height=0.7cm]{iitb-logo.png}\hspace{22pt}\\ +\hspace{6.7cm}\begin{pspicture}(0.1cm,0.1cm) \psbarcode{$qr_code}{eclevel=L width=0.25 height=0.25}{qrcode}\end{pspicture}\\ +\hspace{6.7cm}\tiny{\color{black}\texttt{$serial_key}}\\ + +} + +\end{minipage} +} +\end{document} diff --git a/certificate/views.py b/certificate/views.py index b3d6c5e..a82bcc0 100755 --- a/certificate/views.py +++ b/certificate/views.py @@ -1823,55 +1823,16 @@ def scipy_download_2016(request): file_name = file_name.replace('.', '') - # try: - # old_user = Certificate.objects.get(email=email, serial_no=serial_no) - # qrcode = 'Verify at: http://fossee.in/certificates/verify/{0} '.format(old_user.short_key) - # details = {'name': name, 'serial_key': old_user.short_key} - # certificate = create_scipy_certificate_2016(certificate_path, details, qrcode, type, paper, workshop, file_name) - # print "==========", certificate[1] - # if not certificate[1]: - # old_user.counter = old_user.counter + 1 - # old_user.save() - # return render(request, 'scipy_download_2016.html') - # except Certificate.DoesNotExist: - # uniqueness = False - # num = 5 - # while not uniqueness: - # present = Certificate.objects.filter(short_key__startswith=serial_key[0:num]) - # if not present: - # short_key = serial_key[0:num] - # uniqueness = True - # else: - # num += 1 - # qrcode = 'Verify at: http://fossee.in/certificates/verify/{0} '.format(short_key) - # details = {'name': name, 'serial_key': short_key} - # certificate = create_scipy_certificate_2016(certificate_path, details, - # qrcode, type, paper, workshop, file_name) - # if not certificate[1]: - # certi_obj = Certificate(name=name, email=email, serial_no=serial_no, - # counter=1, workshop=workshop, paper=paper, serial_key=serial_key, short_key=short_key) - # certi_obj.save() - # return render(request, 'scipy_download_2016.html') - - # if certificate[1]: - # _clean_certificate_certificate(certificate_path, file_name) - # context['error'] = True - # return render_to_response('scipy_download_2016.html', context, ci) - # context['message'] = '' - # return render_to_response('scipy_download_2016.html', context, ci) - - - - try: old_user = Certificate.objects.get(email=email, serial_no=serial_no) qrcode = 'Verify at: http://fossee.in/certificates/verify/{0} '.format(old_user.short_key) details = {'name': name, 'serial_key': old_user.short_key} certificate = create_scipy_certificate_2016(certificate_path, details, qrcode, type, paper, workshop, file_name) + print "==========", certificate[1] if not certificate[1]: old_user.counter = old_user.counter + 1 old_user.save() - return certificate[0] + return render(request, 'scipy_download_2016.html') except Certificate.DoesNotExist: uniqueness = False num = 5 @@ -1890,7 +1851,7 @@ def scipy_download_2016(request): certi_obj = Certificate(name=name, email=email, serial_no=serial_no, counter=1, workshop=workshop, paper=paper, serial_key=serial_key, short_key=short_key) certi_obj.save() - return certificate[0] + return render(request, 'scipy_download_2016.html') if certificate[1]: _clean_certificate_certificate(certificate_path, file_name) @@ -1900,6 +1861,45 @@ def scipy_download_2016(request): return render_to_response('scipy_download_2016.html', context, ci) + + + # try: + # old_user = Certificate.objects.get(email=email, serial_no=serial_no) + # qrcode = 'Verify at: http://fossee.in/certificates/verify/{0} '.format(old_user.short_key) + # details = {'name': name, 'serial_key': old_user.short_key} + # certificate = create_scipy_certificate_2016(certificate_path, details, qrcode, type, paper, workshop, file_name) + # if not certificate[1]: + # old_user.counter = old_user.counter + 1 + # old_user.save() + # return certificate[0] + # except Certificate.DoesNotExist: + # uniqueness = False + # num = 5 + # while not uniqueness: + # present = Certificate.objects.filter(short_key__startswith=serial_key[0:num]) + # if not present: + # short_key = serial_key[0:num] + # uniqueness = True + # else: + # num += 1 + # qrcode = 'Verify at: http://fossee.in/certificates/verify/{0} '.format(short_key) + # details = {'name': name, 'serial_key': short_key} + # certificate = create_scipy_certificate_2016(certificate_path, details, + # qrcode, type, paper, workshop, file_name) + # if not certificate[1]: + # certi_obj = Certificate(name=name, email=email, serial_no=serial_no, + # counter=1, workshop=workshop, paper=paper, serial_key=serial_key, short_key=short_key) + # certi_obj.save() + # return certificate[0] + + # if certificate[1]: + # _clean_certificate_certificate(certificate_path, file_name) + # context['error'] = True + # return render_to_response('scipy_download_2016.html', context, ci) + # context['message'] = '' + # return render_to_response('scipy_download_2016.html', context, ci) + + def create_scipy_certificate_2016(certificate_path, name, qrcode, type, paper, workshop, file_name): error = False try: @@ -1932,34 +1932,36 @@ def create_scipy_certificate_2016(certificate_path, name, qrcode, type, paper, w create_tex.write(content_tex) create_tex.close() return_value, err = _make_certificate_certificate(certificate_path, type, file_name) + # if return_value == 0: + # pdf = open('{0}{1}.pdf'.format(certificate_path, file_name) , 'r') + # response = HttpResponse(content_type='application/pdf') + # response['Content-Disposition'] = 'attachment; \ + # filename=%s' % (download_file_name) + # response.write(pdf.read()) + # _clean_certificate_certificate(certificate_path, file_name) + # return [response, False] + # else: + # error = True + if return_value == 0: pdf = open('{0}{1}.pdf'.format(certificate_path, file_name) , 'r') - response = HttpResponse(content_type='application/pdf') - response['Content-Disposition'] = 'attachment; \ - filename=%s' % (download_file_name) - response.write(pdf.read()) + path = os.path.join(certificate_path, str(file_name)+ ".pdf") + print "path-------------", path + try : + subject = 'subject' + from_email = 'from_email@gmail.com' + to = ['inbox.komal@gmail.com',] + message = path + msg = EmailMultiAlternatives(subject, message, from_email, [to]) + # msg.attach_file(path) + msg.content_subtype = "html" + msg.send() + except Exception as e: + print e _clean_certificate_certificate(certificate_path, file_name) - return [response, False] + return [None, False] else: error = True - # if return_value == 0: - # pdf = open('{0}{1}.pdf'.format(certificate_path, file_name) , 'r') - # path = os.path.join(certificate_path, str(file_name)+ ".pdf") - # print "path-------------", path - # try : - # subject = 'subject' - # from_email = 'from_email@gmail.com' - # to = ['inbox.komal@gmail.com',] - # message = path - # msg = EmailMultiAlternatives(subject, message, from_email, [to]) - # msg.attach_file(path) - # msg.content_subtype = "html" - # msg.send() - # except Exception as e: - # print e - # return [None, False] - # else: - # error = True except Exception, e: error = True return [None, error] |