Exemplo n.º 1
0
    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
Exemplo n.º 2
0
 def render_to_file(self):
     """
     Renders a PDF report to a temporary file
     """
     return generate_pdf(self.template_name, context=self.get_context_data())