Answer the question
In order to leave comments, you need to log in
How to type cast in Django/Django-Firebird?
I use the following code to display the blob to the user as a downloadable file:
attachment = DocAttachment.objects.get(pk=id)
response = HttpResponse(attachment.content, content_type='application/pdf')
return response
con = fdb.connect(dsn='database.fdb', user='user', password='password')
cur = con.cursor()
cur.execute("select content from doc_attachment where id = 39")
row = cur.fetchone()
br = row[0]
response = HttpResponse(br.read(), content_type='application/pdf')
return response
Answer the question
In order to leave comments, you need to log in
response = HttpResponse(attachment.content, content_type='application/pdf')
response['Content-Disposition'] = 'attachment; filename="doc_attachment.pdf"'
return response
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question