title: Exporting items from a model to CSV Django / Python
body: <p>I'm fairly new to django and Python and want to be able to export a list of items in my model i.e products. I'm looking at the documentation here - <a href="https://docs.djangoproject.com/en/dev/howto/outputting-csv/">https://docs.djangoproject.com/en/dev/howto/outputting-csv/</a></p>
  
  <p>I'm persuming I need will need to create a variable that stores all the data that I want. But not sure where it would within the snippet of code on the link above.</p>
  
  <p>Apologies as this is a very noobish question but would really Any help at all.</p>
  
  <p>Here is the code to my script so far:</p>
  
  <pre><code>import csv
  
  from products.models import Product
  
  from django.http import HttpResponse
  
  
  def export_to_csv(request):
      response = HttpResponse(content_type='text/csv')
      response['Content-Disposition'] = 'attachment; filename="mytest.csv"'
  </code></pre>