title: Django: change pdf file name using pisa reportlab
body: <p>I have a Django application which prints out a pdf file. I would like to know how to change the pdf file output name. Here is my views.</p>
  
  <pre><code>def write_pdf(template_src, context_dict):
      template = get_template(template_src)
      context = Context(context_dict)
      html  = template.render(context)
      result = StringIO.StringIO()
  
      pdf = pisa.pisaDocument(StringIO.StringIO(html.encode("ISO-8859-1")), result)
      if not pdf.err:
          return HttpResponse(result.getvalue(), mimetype='application/pdf')
          response['Content-Disposition'] = 'attachment; filename=Client_Summary.pdf'
          return response
      return HttpResponse('We had some errors&lt;pre&gt;%s&lt;/pre&gt;' % cgi.escape(html))
  
  
  def client_summary_pdf(request, client_id):
      client = models.Client.objects.get(pk = client_id)
      items = client.storageitem_set.all()
      return write_pdf('client_summary.html',{
          'pagesize' : 'A4',
          'client':client,
          'items':items})
  </code></pre>
  
  <p>As you can see, I have tried saying <code>response['Content-Disposition'] = 'attachment; filename=Client_Summary.pdf'</code>, but this does not work. It basically opens/saves the pdf file without a name.</p>