this is the code:
def render_to_pdf(template_src, context_dict):
template = get_template(template_src)
context = Context(context_dict)
html = template.render(context)
result = StringIO.StringIO()
pdf = pisa.pisaDocument(StringIO.StringIO(html.encode("UTF-8")), result)
if not pdf.err:
return HttpResponse(result.getvalue(), mimetype='application/pdf')
return HttpResponse('We had some errors<pre>%s</pre>' % escape(html))
I am using django 1.7 and error
init () received an unexpected keyword argument 'mimetype'
Request Method: GET Request URL: http://127.0.0.1:8000/admin/amministrazione/ddts/stampa/1/
Django Version: 1.7.7 Exception Type: TypeError Exception:
init () received an unexpected keyword argument 'mimetype'
Exception Place: /home/stefano/.virtualenvs/company2/local/lib/python2.7/site-packages/django/http/response.py in init , line 318 Python executable: /home/stefano/.virtualenvs/company2 / bin / python Python Version: 2.7.6