title: Django and reportlab issue for dynamic report
body: <p>I’m using django and reportlab tool generate Dynamic PDF reports. All the data in report is coming from database.</p>
  
  <p>I’m generating dynamic PDF report using reportlab which consist of the data from database. My problem is whenever I restart Apache server my PDF reports data is changing. The generated report uses Django queries to display the data. But when I restart apache server then the correct data is not appearing in report.</p>
  
  <p>I checked all the queries which I written in my django views. Also I noticed that every restart of Apache server showing different results. So I don’t think so that this is the problem of my django queries. Is there any solution for this problem?</p>
  
  <p>If I restart the apache server data of already generated reports will change, what is the cause for this problem, any solutions?</p>
  
  <p>Or it is due to apache server?</p>
  
  <p>Here is the source code. I think StringIO is wrongly placed.</p>
  
  <pre><code>buffer = StringIO()
  
  def analysis_report(request, sample_no, contact_person):
  
  """
  This function generates the analysis report by using the
  client information, transformer details, sample data and
  test results of respective analysis.
  """
  
  response = HttpResponse(mimetype='application/pdf')
  response['Content-Disposition'] = 'attachment;filename=ANALYSIS_REPORT.pdf'
  
  doc = SimpleDocTemplate(buffer)
  
  document = []
  doc.sample_no = sample_no
  doc.contact_person = contact_person
  
  image = Paragraph(stamp_image, STYLES['NORMAL_RIGHT'])
  
  document.append(image)
  
  # BUILTIN FUNCTION TO GENERATE THE DOCUMENT.
  
  doc.build(document, onLaterPages=header_footer)
  
  pdf = buffer.getvalue()
  
  response.write(pdf) 
  
  return response
  </code></pre>
  
  <p>Thanks in advance</p>