old_contents: from couchexport.export import export, Format
  from django.http import HttpResponse
  from StringIO import StringIO
  import json
  
  def export_data(request, **kwargs):
      """
      Download all data for a couchdbkit model
      """
      export_tag = request.GET.get("export_tag", "")
      if not export_tag:
          raise Exception("You must specify a model to download!")
      try:
          # try to parse this like a compound json list 
          export_tag = json.loads(request.GET.get("export_tag", ""))
      except ValueError:
          pass # assume it was a string
      format = request.GET.get("format", Format.XLS_2007)
      tmp = StringIO()
      if export(export_tag, tmp, format=format):
          response = HttpResponse(mimetype='application/vnd.ms-excel')
          response['Content-Disposition'] = 'attachment; filename=%s.%s' % (export_tag, format)
          response.write(tmp.getvalue())
          tmp.close()
          return response
      else:
          return HttpResponse("Sorry, there was no data found for the tag '%s'." % export_tag)
  
new_contents: from couchexport.export import export, Format
  from django.http import HttpResponse
  from StringIO import StringIO
  import json
  
  def export_data(request, **kwargs):
      """
      Download all data for a couchdbkit model
      """
      export_tag = request.GET.get("export_tag", "")
      if not export_tag:
          raise Exception("You must specify a model to download!")
      try:
          # try to parse this like a compound json list 
          export_tag = json.loads(request.GET.get("export_tag", ""))
      except ValueError:
          pass # assume it was a string
      format = request.GET.get("format", Format.XLS_2007)
      filename_base = request.GET.get("filename", export_tag)
      tmp = StringIO()
      if export(export_tag, tmp, format=format):
          response = HttpResponse(mimetype='application/vnd.ms-excel')
          response['Content-Disposition'] = 'attachment; filename=%s.%s' % (filename_base, format)
          response.write(tmp.getvalue())
          tmp.close()
          return response
      else:
          return HttpResponse("Sorry, there was no data found for the tag '%s'." % export_tag)
  
subject: support filename parameter for export doc