pisa kullanarak bir pdf dosyasına bir html şablonu oluşturmak istiyorum. İhtiyacım olan tüm paketlere sahip olduğuma inanıyorum ama bunu yaparken sorun yaşıyorum. İşte benim görüşüme göre, ne yaptığım için .Pisa ile Django pdf sorusu
DÜZENLEME: Benim en son URL'm, görünüm & şablon.
şablon olarak url.py
(r'^index/render_pdf/(?P<id>\d+)/$', render_pdf),
views.py
def fetch_resources(uri, rel):
path = os.path.join(settings.MEDIA_ROOT, uri.replace(settings.MEDIA_URL, ""))
return path
def render_pdf (html, id):
invoice_items_list = Invoice_Items.objects.filter(pk=id)
result = StringIO.StringIO()
pdf = pisa.pisaDocument(StringIO.StringIO(html.encode("ISO-8859-1")), dest=result, link_callback=fetch_resources)
return result
, ben bu etiketi var.
<a href="{% url c2duo.views.render_pdf invoices.pk %}">
, size yaşıyorsanız tam hata Traceback veya davranışı almak ve eklemek Soru, böylece herkes bu şekilde denediğinizde neler olduğunu görebilir. – nosklo
"render_to_pdf (template_src, context_dict)' içinde "dönüş" yoktur. Gerçekte kullandığınız gerçek koddan daha fazlasını içerir misiniz? –
Kod güncellendi – Shehzad009