Generate PDF version of the resume
This commit is contained in:
parent
6c2b7873c2
commit
cf08e3e0e4
@ -1,9 +1,9 @@
|
||||
{% extends 'front_base.html' %}
|
||||
{% extends pdf|yesno:'resume_pdf.html,front_base.html' %}
|
||||
|
||||
{% block title %} - Resume{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<h3>Resume <span id="keywords-button">[ want some keywords only? click this! ]</span></h3>
|
||||
<h3>Resume{% if not pdf %} <span id="keywords-button">[ want some keywords only? click this! ]</span>{% endif %}</h3>
|
||||
|
||||
<div itemscope itemtype="http://schema.org/Person">
|
||||
<p>I am <span class="b" itemprop="name">Gergely Polonkai</span> (sometimes referred to as <span itemprop="nickname">W00d5t0ck</span> or <span itemprop="nickname">Polesz</span>), a <span class="b" itemprop="jobTitle">software developer, systems engineer and administrator</span>. I was born on <span class="b" itemprop="birthDate">7 March, 1983</span> in Budapest, Hungary. I spent my life moving here-and-there in the country, and finally settled in <span class="b" itemprop="address" itemscope itemtype="http://schema.org/Address"><span itemprop="locality">Budapest</span></span>. Although I have already found my mate for life, I am <span class="b">single</span> yet (living in a common-law marriage), being the proud father of a son and a daughter.</p>
|
||||
@ -20,7 +20,7 @@
|
||||
</div>
|
||||
|
||||
<div id="keywords"><span id="keywords-close"></span><span id="keywords-list"></span></div>
|
||||
<div id="page-disclaimer">You can download the latest version of my resume at <a href="http://{{ site.domain }}{% url "basics:resume" %}">http://{{ site.domain }}{% url "basics:resume" %}</a>.</div>
|
||||
<div id="page-disclaimer">You can download the latest version of my resume at <a href="http://{{ site.domain }}{% url "basics:resumepdf" %}">http://{{ site.domain }}{% url "basics:resumepdf" %}</a>.</div>
|
||||
|
||||
<script type="text/javascript">
|
||||
Array.prototype.unique = function() {
|
||||
|
12
basics/templates/resume_pdf.html
Normal file
12
basics/templates/resume_pdf.html
Normal file
@ -0,0 +1,12 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
||||
<head>
|
||||
<title>Gergely Polonkai - Resume</title>
|
||||
<meta name="generator" content="ViM" />
|
||||
<meta name="author" content="Gergely Polonkai" />
|
||||
</head>
|
||||
<body>
|
||||
{% block content %}{% endblock %}
|
||||
</body>
|
||||
</html>
|
||||
|
@ -3,6 +3,7 @@ from basics import views
|
||||
|
||||
urlpatterns = patterns('',
|
||||
url(r'^resume$', views.resume, name = 'resume'),
|
||||
url(r'^resume.pdf$', views.resumepdf, name = 'resumepdf'),
|
||||
url(r'^about$', views.about, name = 'about'),
|
||||
url(r'^disclaimer$', views.disclaimer, name = 'disclaimer'),
|
||||
)
|
||||
|
@ -1,10 +1,27 @@
|
||||
from django.shortcuts import render
|
||||
from django.contrib.sites.models import get_current_site
|
||||
from django.http import HttpResponse
|
||||
from django.template.loader import render_to_string
|
||||
from StringIO import StringIO
|
||||
from xhtml2pdf import pisa
|
||||
|
||||
def googlevalidator(request):
|
||||
return HttpResponse('')
|
||||
|
||||
def resumepdf(request):
|
||||
body = render_to_string('basics/resume.html', { 'site': get_current_site(request), 'pdf': True })
|
||||
dst = StringIO()
|
||||
pdf = pisa.CreatePDF(body, dst)
|
||||
pdf_data = dst.getvalue()
|
||||
dst.close()
|
||||
|
||||
if not pdf.err:
|
||||
return HttpResponse(pdf_data, mimetype = 'application/pdf')
|
||||
|
||||
return HttpResponse('We had some errors<pre>%s</pre>' % escape(html))
|
||||
|
||||
return render(request, 'basics/resume.html', { 'site': get_current_site(request), 'pdf': True })
|
||||
|
||||
def resume(request):
|
||||
return render(request, 'basics/resume.html', { 'site': get_current_site(request) })
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user