Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Mejorando los PDFs

  • Loading branch information...
commit 5b0327a529770652b0150cd087a239d1de73d5fd 1 parent 6506717
@jonlatorre authored
View
11 README.md
@@ -0,0 +1,11 @@
+MatriculaEIDE
+============
+Este e sun peque?o progarma para gestionar las matriculas a los examenes de cambridge ofertados por el centro EIDE (http://eide.es))
+
+Author
+------
+
+ - Jon Latorre Martinez <jonlatorremartinez@gmail.com>
+
+License
+-------
View
8 apps/cambridge/templates/cambridge/imprimir.html
@@ -13,7 +13,7 @@
<td>Apellidos</td><td>{{ registration.surname }}</td>
</tr>
<tr>
- <td>Direccion</td><td>{{ registration.address }}</td>
+ <td>Dirección</td><td>{{ registration.address }}</td>
</tr>
<tr>
@@ -32,19 +32,19 @@
<td>DNI</td><td>{{ registration.dni }}</td>
</tr>
<tr>
- <td>Telefono</td><td>{{ registration.telephone }}</td>
+ <td>Teléfono</td><td>{{ registration.telephone }}</td>
</tr>
<tr>
<td>e-mail</td><td>{{ registration.email }}</td>
</tr>
<tr>
- <td>Alumno EIDE?</td><td>{{ registration.eide_alumn }}</td>
+ <td>¿Es alumno de EIDE?</td><td>{{ registration.eide_alumn }}</td>
</tr>
<tr>
<td>Centro</td><td>{{ registration.centre_name }}</td>
</tr>
<tr>
- <td>Fecha Matrocula</td><td>{{ registration.registration_date }}</td>
+ <td>Fecha Matrícula</td><td>{{ registration.registration_date }}</td>
</tr>
View
91 apps/cambridge/templates/cambridge/matricula_imprimir.html
@@ -0,0 +1,91 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<HTML>
+<HEAD>
+ <META HTTP-EQUIV="CONTENT-TYPE" CONTENT="text/html; charset=us-ascii">
+ <TITLE>MATRICULA {{ registration.id }}-{{ registration.dni }}</TITLE>
+ <META NAME="GENERATOR" CONTENT="LibreOffice 3.5 (Linux)">
+ <META NAME="AUTHOR" CONTENT="Beatriz Iglesias Uriarte">
+ <META NAME="CREATED" CONTENT="20120307;19470000">
+ <META NAME="CHANGEDBY" CONTENT="EIDE">
+ <META NAME="CHANGED" CONTENT="20120313;13360000">
+ <META NAME="Info 1" CONTENT="">
+ <META NAME="Info 2" CONTENT="">
+ <META NAME="Info 3" CONTENT="">
+ <META NAME="Info 4" CONTENT="">
+ <STYLE TYPE="text/css">
+ <!--
+ @page { margin-left: 2cm; margin-right: 2cm; margin-top: 1.25cm; margin-bottom: 0.83cm }
+ P { margin-bottom: 0.21cm; direction: ltr; color: #000000; widows: 2; orphans: 2 }
+ P.western { font-family: "Times New Roman", serif; font-size: 12pt; so-language: es-ES }
+ P.cjk { font-family: "Times New Roman", serif; font-size: 12pt }
+ P.ctl { font-family: "Times New Roman", serif; font-size: 12pt; so-language: ar-SA }
+ H1 { margin-top: 0cm; margin-bottom: 0cm; direction: ltr; color: #000000; text-align: center; widows: 2; orphans: 2 }
+ H1.western { font-family: "Times New Roman", serif; font-size: 12pt; so-language: es-ES }
+ H1.cjk { font-family: "Times New Roman", serif; font-size: 12pt }
+ H1.ctl { font-family: "Tahoma", sans-serif; font-size: 12pt; so-language: ar-SA }
+ H2 { margin-top: 0cm; margin-bottom: 0cm; direction: ltr; color: #000000; text-align: center; widows: 2; orphans: 2 }
+ H2.western { so-language: es-ES; font-style: italic }
+ H2.cjk { font-family: "Times New Roman", serif; font-style: italic }
+ H2.ctl { font-family: "Tahoma", sans-serif; font-size: 12pt; so-language: ar-SA; font-style: italic }
+ P.sdfootnote-western { margin-bottom: 0cm; font-family: "Times New Roman", serif; font-size: 10pt; so-language: es-ES }
+ P.sdfootnote-cjk { margin-bottom: 0cm; font-family: "Times New Roman", serif; font-size: 10pt }
+ P.sdfootnote-ctl { margin-bottom: 0cm; font-family: "Times New Roman", serif; font-size: 10pt; so-language: ar-SA }
+ A:link { color: #0000ff }
+ A.sdfootnoteanc { font-size: 57% }
+ -->
+ </STYLE>
+</HEAD>
+<BODY LANG="es-ES" TEXT="#000000" LINK="#0000ff" DIR="LTR">
+
+<P LANG="en-GB" CLASS="western" ALIGN=CENTER STYLE="margin-bottom: 0cm">
+<BR>
+</P>
+<H1 CLASS="western" ALIGN=LEFT></H1>
+<H1 CLASS="western"><FONT FACE="Arial, sans-serif"><FONT SIZE=4 STYLE="font-size: 16pt"><U>MATR&Iacute;CULA PARA LOS EXAMENES </U></FONT></FONT>
+</H1>
+<H1 CLASS="western"><FONT FACE="Arial, sans-serif"><FONT SIZE=4 STYLE="font-size: 16pt"><U>UNIVERSITY OF CAMBRIDGE &ndash; ESOL</U></FONT></FONT></H1>
+<P CLASS="western" STYLE="margin-bottom: 0cm"><BR>
+</P>
+
+<P CLASS="western" ALIGN=LEFT STYLE="margin-bottom: 0cm"><FONT FACE="Albertus Extra Bold, Times New Roman, serif"><FONT SIZE=4><B>CENTRO
+ N&ordm; ES 165</B></FONT></FONT></P>
+
+<BR>
+
+<H1 CLASS="western" STYLE="background: #737373"><FONT COLOR="#ffffff"><FONT FACE="Arial, sans-serif"><FONT SIZE=4>CONVOCATORIA {{ registration.exam.exam_date }}</FONT></FONT></FONT></H1>
+
+<br>
+
+<P CLASS="western" ALIGN=JUSTIFY STYLE="margin-bottom: 0cm; line-height: 200%">
+<FONT FACE="Arial, sans-serif"><FONT SIZE=2><B>NOMBRE Y APELLIDOS:</B> {{ registration.surname }}, {{ registration.name }}</FONT></FONT></P>
+
+<P CLASS="western" ALIGN=JUSTIFY STYLE="margin-bottom: 0cm; line-height: 200%">
+<FONT FACE="Arial, sans-serif"><FONT SIZE=2><B>DIRECCI&Oacute;N: </B>{{ registration.address }} </FONT></FONT></P>
+
+<P CLASS="western" ALIGN=JUSTIFY STYLE="margin-bottom: 0cm; line-height: 200%">
+<FONT FACE="Arial, sans-serif"><FONT SIZE=2><B>POBLACI&Oacute;N:</B> {{ registration.location }}
+</FONT></FONT></P>
+
+<P CLASS="western" ALIGN=JUSTIFY STYLE="margin-bottom: 0cm; line-height: 200%">
+<FONT FACE="Arial, sans-serif"><FONT SIZE=2><B> CODIGO POSTAL: {{ registration.postal_code }}</B></FONT></FONT></P>
+<P CLASS="western" ALIGN=JUSTIFY STYLE="margin-bottom: 0cm; line-height: 150%">
+
+<FONT FACE="Arial, sans-serif"><FONT SIZE=2><B>TEL&Eacute;FONO(S):</B> {{ registration.telephone }} </FONT></FONT></P>
+<P CLASS="western" ALIGN=JUSTIFY STYLE="margin-bottom: 0cm; line-height: 200%">
+<FONT FACE="Arial, sans-serif"><FONT SIZE=2>
+<B> F. NACIMIENTO:</B>{{ registration.born_date }}</FONT></FONT></P>
+<P CLASS="western" ALIGN=JUSTIFY STYLE="margin-bottom: 0cm; line-height: 150%">
+<B><FONT FACE="Arial, sans-serif"><FONT SIZE=2>ALUMNO/A DE EIDE:</B>{{ registration.eide_alumn }}</FONT></FONT></P>
+
+<P CLASS="western" ALIGN=JUSTIFY STYLE="margin-bottom: 0cm; line-height: 200%">
+ <FONT FACE="Arial, sans-serif"><FONT SIZE=2>
+ <B>ESPECIFICAR CENTRO:</B>{{ registration.centre_name }}
+ </FONT></FONT>
+</P>
+
+<P CLASS="western" ALIGN=JUSTIFY STYLE="margin-right: 8.75cm; margin-bottom: 0cm; border: 1.50pt solid #000000; padding: 0.04cm 0.14cm">
+<FONT FACE="Arial, sans-serif"><B>CANDIDATE NUMBER: </B></FONT>
+</P>
+
+</BODY>
+</HTML>
View
24 apps/cambridge/views.py
@@ -4,15 +4,18 @@
from django.template import RequestContext
from django.http import HttpResponse
-from django.shortcuts import get_object_or_404
+from django.shortcuts import get_object_or_404, render_to_response
import StringIO
import ho.pisa as pisa
from django_xhtml2pdf.utils import render_to_pdf_response
+#from utils import render_to_pdf_response
from models import *
+
+
# import the logging library
import logging
@@ -27,21 +30,16 @@ def ver(request, pk):
myfile = StringIO.StringIO()
return HttpResponse( file_data )
-def fetch_resources(uri, rel):
- #path = os.path.join(settings.MEDIA_ROOT, uri.replace(settings.MEDIA_URL, ""))
- path = settings.MEDIA_ROOT + uri
- return path
+
def imprimir(registration,request):
payload = {'registration': registration}
- file_data = render_to_string('cambridge/imprimir.html', payload, RequestContext(request))
- myfile = StringIO.StringIO()
- pisa.CreatePDF(file_data, myfile, link_callback=fetch_resources)
- myfile.seek(0)
- response = HttpResponse(myfile, mimetype='application/pdf')
- response['Content-Disposition'] = 'attachment; filename=cambridge-%s.pdf'%registration.id
- response2 = render_to_pdf_response('cambridge/imprimir.html', payload, 'cambridge-%s.pdf'%registration.id)
- return response2
+ response_pdf = render_to_pdf_response('cambridge/matricula_imprimir.html',
+ payload, pdfname='cambridge-%s.pdf'%registration.id)
+ response_html = render_to_response('cambridge/matricula_imprimir.html',
+ payload)
+
+ return response_pdf
@login_required
def imprimir_cambridge(request, pk):
Please sign in to comment.
Something went wrong with that request. Please try again.