Change resume link to work without the sites module

It is a bit overkill without actual sites
This commit is contained in:
Gergely Polonkai 2014-06-19 08:53:22 +00:00
parent 2b86c16ec5
commit d3f74bbbc2
2 changed files with 12 additions and 3 deletions

View File

@ -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:resumepdf" %}">http://{{ site.domain }}{% url "basics:resumepdf" %}</a>.</div>
<div id="page-disclaimer">You can download the latest version of my resume at <a href="{{ resume_link }}">{{ resume_link }}</a>.</div>
<script type="text/javascript">
Array.prototype.unique = function() {

View File

@ -2,14 +2,21 @@ 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 django.core.urlresolvers import reverse
from StringIO import StringIO
from xhtml2pdf import pisa
def googlevalidator(request):
return HttpResponse('')
def resumelink(request):
return request.build_absolute_uri(reverse('basics:resumepdf'))
def resumepdf(request):
body = render_to_string('basics/resume.html', { 'site': get_current_site(request), 'pdf': True })
body = render_to_string('basics/resume.html', {
'resume_link': resumelink(request),
'pdf': True
})
dst = StringIO()
pdf = pisa.CreatePDF(body, dst)
pdf_data = dst.getvalue()
@ -21,7 +28,9 @@ def resumepdf(request):
return HttpResponse('We had some errors: <pre>%s</pre>' % escape(html))
def resume(request):
return render(request, 'basics/resume.html', { 'site': get_current_site(request) })
return render(request, 'basics/resume.html', {
'resume_link': resumelink(request)
})
def about(request):
return render(request, 'basics/about.html', {})