def note2pdf_response(request: HttpRequest, note: Note) -> HttpResponse: # Source: https://stackoverflow.com/a/48697734 template = 'note2pdf.html' note.rendered_content = render_markdown(note.content) context = {'note': note} response = render_to_pdf_response(request, template, context) response['Content-Disposition'] = 'attachment; filename="note-%s.pdf"' % str(note.id) return response
def note2pdf_response(request: HttpRequest, note: Note) -> HttpResponse: # Source: https://stackoverflow.com/a/48697734 template = 'note2pdf.html' note.rendered_content = render_markdown(note.content) context = {'note': note} response = render_to_pdf_response(request, template, context) response[ 'Content-Disposition'] = 'attachment; filename="note-%s.pdf"' % str( note.id) return response
def note2pdf(note: Note): template = 'note2pdf.html' note.rendered_content = render_markdown(note.content) context = {'note': note} return render_to_pdf(template, context)