title: Returning CSV format from django-rest-framework?
body: <p>I have a working Django 1.8 site, and I want to add a RESTful API using django-rest-framework. I would like to support rendering to CSV and JSON formats, and am puzzling over how to do this.  </p>
  
  <p>In <code>api/urls.py</code> I have this:</p>
  
  <pre><code>from django.conf.urls import url, include
  from rest_framework import routers
  from rest_framework.urlpatterns import format_suffix_patterns
  import views
  
  router = routers.DefaultRouter()
  urlpatterns = [
    url(r'^organisation/$', views.organisation), 
  ]
  urlpatterns = format_suffix_patterns(urlpatterns,
                                   allowed=['json', 'csv'])
  </code></pre>
  
  <p>And I have this in <code>api/views.py</code>:</p>
  
  <pre><code>class JSONResponse(HttpResponse):
      """
      An HttpResponse that renders its content into JSON.
      """
      def __init__(self, data, **kwargs):
          content = JSONRenderer().render(data)
          kwargs['content_type'] = 'application/json'
          super(JSONResponse, self).__init__(content, **kwargs)
  
  @api_view(['GET'])
  def organisation(request, format=None):
      code = request.query_params.get('code', None)
      print 'format', format
      organisation = Organisation.objects.get(code=code)
      serializer = OrgSerializer(organisation)
      data = serializer.data
      return JSONResponse(data)
  </code></pre>
  
  <p>But if I go to <code>api/1.0/organisation.csv?code=123</code>, I still see:</p>
  
  <pre><code>format json
  </code></pre>
  
  <p>in the console. </p>
  
  <p>What am I doing wrong? And how should I return CSV once I have managed to capture the format? (I suspect I'm probably doing the wrong thing by writing my own <code>JSONResponse</code>, already.)</p>