diff --git a/cartridge/shop/templates/shop/complete.html b/cartridge/shop/templates/shop/complete.html
index 337da42aa..8137e5dba 100644
--- a/cartridge/shop/templates/shop/complete.html
+++ b/cartridge/shop/templates/shop/complete.html
@@ -77,7 +77,9 @@
diff --git a/cartridge/shop/views.py b/cartridge/shop/views.py
index 2fe48b49c..aa1cce025 100644
--- a/cartridge/shop/views.py
+++ b/cartridge/shop/views.py
@@ -14,12 +14,16 @@
from django.template.loader import get_template
from django.utils.translation import ugettext as _
from django.views.decorators.cache import never_cache
-
from mezzanine.conf import settings
from mezzanine.utils.importing import import_dotted_path
from mezzanine.utils.views import render, set_cookie, paginate
from mezzanine.utils.urls import next_url
+try:
+ from xhtml2pdf import pisa
+except (ImportError, SyntaxError):
+ pisa = None
+
from cartridge.shop import checkout
from cartridge.shop.forms import (AddProductForm, CartItemFormSet,
DiscountForm, OrderForm)
@@ -345,7 +349,7 @@ def complete(request, template="shop/complete.html"):
names[variation.sku] = variation.product.title
for i, item in enumerate(items):
setattr(items[i], "name", names[item.sku])
- context = {"order": order, "items": items,
+ context = {"order": order, "items": items, "has_pdf": pisa is not None,
"steps": checkout.CHECKOUT_STEPS}
return render(request, template, context)
@@ -369,8 +373,7 @@ def invoice(request, order_id, template="shop/order_invoice.html",
name = slugify("%s-invoice-%s" % (settings.SITE_TITLE, order.id))
response["Content-Disposition"] = "attachment; filename=%s.pdf" % name
html = get_template(template_pdf).render(context)
- import ho.pisa
- ho.pisa.CreatePDF(html, response)
+ pisa.CreatePDF(html, response)
return response
return render(request, template, context)
diff --git a/setup.py b/setup.py
index 894e8b09d..dc77d646d 100644
--- a/setup.py
+++ b/setup.py
@@ -38,8 +38,7 @@
install_requires=[
"mezzanine >= 3.0.6",
- "pisa >= 3.0.33",
- "reportlab == 2.7"
+ "xhtml2pdf",
],
classifiers=[