2
こんにちは、私はジャンゴの学習段階で私はそう私をサポートしています。 私はdjango.Iでpdfレポートを生成する必要があります。詳細はデータベースから選択し、pdf document.iに表示する必要があります。レポートラボを使用しています。 は、今私がモデルdjango出力pdf
class Data(models.Model):
first_name = models.CharField(max_length =100,blank=True,null=True)
last_name = models.CharField(max_length =100,blank=True,null=True)
def __unicode__(self):
return self.first_name
に2つのフィールドを作っていると私は、PDFドキュメントには、名前のものは何でも私を表示するようにしたい学習例として、今のコード
def pdf_view(request):
response = HttpResponse(mimetype='application/pdf')
response['Content-Disposition'] = 'attachment; filename=hello.pdf'
p = canvas.Canvas(response)
details = Data.objects.all()
print details
p.drawString(20, 800, details)
p.drawString(30, 700, "I am a Python Django Professional.")
p.showPage()
p.save()
return response
を見て私は、PDF文書内のデータベースおよびディスプレイから詳細をPIKしたい管理者によって埋めるが、それは私にエラー
'Data' object has no attribute 'decode'
Request Method: GET
Request URL: http://localhost:8000/view_pdf/
Django Version: 1.3
Exception Type: AttributeError
Exception Value:
を与えている
'Data' object has no attribute 'decode'
ありがとうございました –