def render(self): """ Renders a PDF report to the HttpRequest object """ ctx = self.get_context_data() self.response = HttpResponse(mimetype='application/pdf', \ content_type='application/pdf; name=%s' % self.filename()) generate_pdf(self.template_name, \ file_object=self.response, context=ctx) self.response['Content-Disposition'] = 'inline; filename=%s' % \ self.filename() return self.response
def render_to_file(self): """ Renders a PDF report to a temporary file """ return generate_pdf(self.template_name, context=self.get_context_data())