From e2388422822ba47b4ef091215ca8b4e3c12cdf19 Mon Sep 17 00:00:00 2001
From: Étienne Loks {{ item.year }} {{ item.numeric_reference }} {{ item.year }} {{ item.numeric_reference }} {{ item.internal_reference }} {{ item.internal_reference }} {{ item.history.all.0.history_date }} {{ item.reception_date }} {{ item.creation_date }} {{ item.history.all.0.history_date }} {{ item.reception_date }} {{ item.creation_date }} {% item.deadline_date %} {% item.deadline_date %} {{ item.in_charge.full_label }} {% if item.is_active %}{%trans "Active file"%} {{ item.in_charge.full_label }} {% if item.is_active %}{%trans "Active file"%}]*)>\n', '
', html)
+
+ odt = NamedTemporaryFile()
options = optparse.Values()
- options.input = ht.name
- options.output = odt.name
- options.template = settings.ODT_TEMPLATE
options.with_network = True
- for k, v in (('input', ht.name),
- ('output', None),
+ for k, v in (('input', ''),
+ ('output', odt.name),
('template', settings.ODT_TEMPLATE),
('with_network', True),
('top_header_level', 1),
@@ -271,19 +277,17 @@ def show_item(model, name):
('htmlid', None),
('url', "#")):
setattr(options, k, v)
- htmlfile = xhtml2odt.HTMLFile(options)
- htmlfile.read()
odtfile = xhtml2odt.ODTFile(options)
odtfile.open()
- odtfile.import_xhtml(htmlfile.html)
- hop = odtfile.save()
+ odtfile.import_xhtml(html)
+ odtfile = odtfile.save()
except xhtml2odt.ODTExportError, ex:
return HttpResponse(content, content_type="application/xhtml")
response = HttpResponse(
mimetype='application/vnd.oasis.opendocument.text')
response['Content-Disposition'] = 'attachment; filename=%s.odt' % \
filename
- response.write(hop)
+ response.write(odtfile)
return response
elif doc_type == 'pdf':
tpl = loader.get_template('sheet_%s.html' % name)
diff --git a/ishtar/templates/sheet.html b/ishtar/templates/sheet.html
index a93b193e0..c157b61a0 100644
--- a/ishtar/templates/sheet.html
+++ b/ishtar/templates/sheet.html
@@ -8,6 +8,7 @@
{% trans "General"%}
-
{{ item.closing.date }} {%trans "by" %} {{ item.closing.user }}
+{{ item.closing.date }} {%trans "by" %} {{ item.closing.user }}
{% endif %} -{{ item.file_type }}
+{{ item.file_type }}
-{% if item.related_file %}{% endif %} -{% if item.comment %}{{ item.comment }}
{%endif%} +{% if item.related_file %}{% endif %} +{% if item.comment %}{{ item.comment }}
{%endif%}{{ item.towns.all|join:", " }}
+{{ item.towns.all|join:", " }}
-{{ item.address }}
-{% if item.address_complement %}{{ item.address_complement }}
{%endif%} -{% if item.postal_code %}{{ item.postal_code }}
{%endif%} +{{ item.address }}
+{% if item.address_complement %}{{ item.address_complement }}
{%endif%} +{% if item.postal_code %}{{ item.postal_code }}
{%endif%} -{{ item.total_surface }} m2 ({{ item.total_surface_ha }} ha)
+{{ item.total_surface }} m2 ({{ item.total_surface_ha }} ha)
{% if item.is_preventive %}{{ item.total_developed_surface }} m2 ({{ item.total_developed_surface_ha }} ha)
-{{ item.saisine_type }}
-{% if item.town_planning_service %}{{ item.town_planning_service }}
{% endif %} -{% if item.permit_type %}{{ item.permit_type }}
{% endif %} -{% if item.permit_reference %}{{ item.permit_reference }}
{% endif %} -{% if item.general_contractor.attached_to %}{{ item.general_contractor.attached_to }}
{% endif %} -{% if item.general_contractor %}{{ item.general_contractor.full_label }}
{% endif %} +{{ item.total_developed_surface }} m2 ({{ item.total_developed_surface_ha }} ha)
+{{ item.saisine_type }}
+{% if item.town_planning_service %}{{ item.town_planning_service }}
{% endif %} +{% if item.permit_type %}{{ item.permit_type }}
{% endif %} +{% if item.permit_reference %}{{ item.permit_reference }}
{% endif %} +{% if item.general_contractor.attached_to %}{{ item.general_contractor.attached_to }}
{% endif %} +{% if item.general_contractor %}{{ item.general_contractor.full_label }}
{% endif %} {% endif %}