Exemplo n.º 1
0
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
Exemplo n.º 2
0
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
Exemplo n.º 3
0
def note2pdf(note: Note):
    template = 'note2pdf.html'
    note.rendered_content = render_markdown(note.content)
    context = {'note': note}
    return render_to_pdf(template, context)
Exemplo n.º 4
0
def note2pdf(note: Note):
    template = 'note2pdf.html'
    note.rendered_content = render_markdown(note.content)
    context = {'note': note}
    return render_to_pdf(template, context)