diff options
Diffstat (limited to 'ishtar')
| -rw-r--r-- | ishtar/furnitures/views.py | 7 | ||||
| -rw-r--r-- | ishtar/templates/sheet_file.html | 4 | ||||
| -rw-r--r-- | ishtar/templates/sheet_file_pdf.html | 14 |
3 files changed, 20 insertions, 5 deletions
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("<table", "<pdf:nextpage/><table repeat='1'") + pdf = pisa.pisaDocument(StringIO.StringIO(html), result) response = HttpResponse(result.getvalue(), mimetype='application/pdf') response['Content-Disposition'] = 'attachment; filename=%s.pdf' % \ diff --git a/ishtar/templates/sheet_file.html b/ishtar/templates/sheet_file.html index 865acca41..0e46f7a6d 100644 --- a/ishtar/templates/sheet_file.html +++ b/ishtar/templates/sheet_file.html @@ -80,7 +80,7 @@ <th>{% trans "In charge" %}</th> <th>{% trans "Start date" %}</th> <th>{% trans "End date" %}</th> - <th> </th> + <th class='link'> </th> </tr> {% for operation in item.operations.all %} <tr> @@ -91,7 +91,7 @@ <td class='string'>{{operation.in_charge|default:""}}</td> <td>{{operation.start_date|default:""}}</td> <td>{{operation.end_date|default:""}}</td> - <td><a href="#{#{%url show-operation operation.pk%}#}">{% trans "Details" %}</a></td> + <td class='link'><a href="#{#{%url show-operation operation.pk%}#}">{% trans "Details" %}</a></td> </tr> {% empty %} <tr><td colspan="8" class='no_items'>{% trans "No operation associated to this archaelogical file" %}</td></tr> 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 }} +<div id="pdfheader"> +Ishtar – {{APP_NAME}} – {{item}} +</div> +{% endblock %} +{%block main_foot%} +<div id="pdffooter"> +– <pdf:pagenumber/> – +</div> +</body> +</html> +{%endblock%} |
