Change resume link to work without the sites module
It is a bit overkill without actual sites
This commit is contained in:
parent
2b86c16ec5
commit
d3f74bbbc2
@ -20,7 +20,7 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div id="keywords"><span id="keywords-close"></span><span id="keywords-list"></span></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">
|
<script type="text/javascript">
|
||||||
Array.prototype.unique = function() {
|
Array.prototype.unique = function() {
|
||||||
|
@ -2,14 +2,21 @@ from django.shortcuts import render
|
|||||||
from django.contrib.sites.models import get_current_site
|
from django.contrib.sites.models import get_current_site
|
||||||
from django.http import HttpResponse
|
from django.http import HttpResponse
|
||||||
from django.template.loader import render_to_string
|
from django.template.loader import render_to_string
|
||||||
|
from django.core.urlresolvers import reverse
|
||||||
from StringIO import StringIO
|
from StringIO import StringIO
|
||||||
from xhtml2pdf import pisa
|
from xhtml2pdf import pisa
|
||||||
|
|
||||||
def googlevalidator(request):
|
def googlevalidator(request):
|
||||||
return HttpResponse('')
|
return HttpResponse('')
|
||||||
|
|
||||||
|
def resumelink(request):
|
||||||
|
return request.build_absolute_uri(reverse('basics:resumepdf'))
|
||||||
|
|
||||||
def resumepdf(request):
|
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()
|
dst = StringIO()
|
||||||
pdf = pisa.CreatePDF(body, dst)
|
pdf = pisa.CreatePDF(body, dst)
|
||||||
pdf_data = dst.getvalue()
|
pdf_data = dst.getvalue()
|
||||||
@ -21,7 +28,9 @@ def resumepdf(request):
|
|||||||
return HttpResponse('We had some errors: <pre>%s</pre>' % escape(html))
|
return HttpResponse('We had some errors: <pre>%s</pre>' % escape(html))
|
||||||
|
|
||||||
def resume(request):
|
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):
|
def about(request):
|
||||||
return render(request, 'basics/about.html', {})
|
return render(request, 'basics/about.html', {})
|
||||||
|
Loading…
Reference in New Issue
Block a user