Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def render_ticket_view(request):
- template_path = 'ticket.html'
- context = {
- ...
- }
- response = PDFTemplateResponse(
- request=request,
- template=template_path,
- filename='file.pdf',
- context=context,
- cmd_options={'load-error-handling': 'ignore'}
- )
- batch = TicketBatch.objects.create()
- batch.document.save(
- "{}-{}.pdf".format(event.name.replace(" ", "_"), batch.id),
- response.rendered_content
- )
- batch.save()
- return response
Add Comment
Please, Sign In to add comment