From 5b3ef3f317085a3f6cf8a319c7ac406047e49b78 Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Sat, 26 Feb 2011 03:08:58 +0100 Subject: Better PDF export(refs #227) --- ishtar/furnitures/views.py | 7 ++++--- ishtar/templates/sheet_file.html | 4 ++-- ishtar/templates/sheet_file_pdf.html | 14 ++++++++++++++ 3 files changed, 20 insertions(+), 5 deletions(-) create mode 100644 ishtar/templates/sheet_file_pdf.html (limited to 'ishtar') diff --git a/ishtar/furnitures/views.py b/ishtar/furnitures/views.py index e874e8cc2..59faeca47 100644 --- a/ishtar/furnitures/views.py +++ b/ishtar/furnitures/views.py @@ -290,11 +290,12 @@ def show_item(model, name): response.write(odtfile) return response elif doc_type == 'pdf': - tpl = loader.get_template('sheet_%s.html' % name) + tpl = loader.get_template('sheet_%s_pdf.html' % name) content = tpl.render(context_instance) result = StringIO.StringIO() - pdf = pisa.pisaDocument(StringIO.StringIO(content.encode("utf-8")), - result) + html = content.encode('utf-8') + html = html.replace("{% trans "In charge" %} - + {% for operation in item.operations.all %} @@ -91,7 +91,7 @@ - + {% empty %} diff --git a/ishtar/templates/sheet_file_pdf.html b/ishtar/templates/sheet_file_pdf.html new file mode 100644 index 000000000..2a23cb6a4 --- /dev/null +++ b/ishtar/templates/sheet_file_pdf.html @@ -0,0 +1,14 @@ +{% extends "sheet_file.html" %} +{% block main_head %} +{{ block.super }} +
+Ishtar – {{APP_NAME}} – {{item}} +
+{% endblock %} +{%block main_foot%} +
+– – +
+ + +{%endblock%} -- cgit v1.2.3
{% trans "Start date" %} {% trans "End date" %}  
{{operation.in_charge|default:""}} {{operation.start_date|default:""}} {{operation.end_date|default:""}}{% trans "Details" %}
{% trans "No operation associated to this archaelogical file" %}