Skip to content

Instantly share code, notes, and snippets.

@jayapal
Created March 27, 2015 08:29
Show Gist options
  • Save jayapal/487b3c4f3021f5a3d362 to your computer and use it in GitHub Desktop.
Save jayapal/487b3c4f3021f5a3d362 to your computer and use it in GitHub Desktop.
def myview(request)
customer = request.session['Customer']
template = preppy.getModule(settings.REPORTS_DIR + '/report_templates/prepfiles/hello.prep')
rmlText = template.get(customer)
response = HttpResponse(mimetype='application/pdf')
response['Content-Disposition'] = 'attachment; filename=hello.pdf'
pdf = rml2pdf.parseString(rmlText)
response.write(pdf.read())
return response
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment