title: Query params on detail view return a list instead of json nested serializers Django Rest Framework
body: <p>I'm rather new to Django Rest Framework and I'm having a problem I don't quite understand.</p>
  
  <p>If I setup a APIView to return all the objects in a particular model I get an array of data as expected </p>
  
  <pre><code>class ProcedureListView(APIView):
  
      def get(self, request, format=None):
          procedures = AutomationProcedure.objects.all()
          serializer = AutomationProcedureSerializer(procedures, many=True)
          return Response(serializer.data)
  </code></pre>
  
  <p>My api call to this endpoint looks like </p>
  
  <pre><code>$ http --json GET http://localhost:8000/api/procedures/
  </code></pre>
  
  <p>And the response 
          [
             {
               ...
               ...
              }
          ]</p>
  
  <p>But if I write a detail view that takes query parameters the single object still returns as a list</p>
  
  <pre><code>class ProcedureDetail(generics.ListAPIView):
  
   def get_queryset(self):
  
      queryset = AutomationProcedure.objects.all()
      display_name = self.request.query_params.get('display_name', None)
      if display_name is not None:
          queryset = queryset.filter(display_name=display_name)
      return queryset
  </code></pre>
  
  <p>And then if I make an API call in this manner:</p>
  
  <pre><code>$ http --json GET http://localhost:8000/api/procedures/ display_name="jenkins"
  </code></pre>
  
  <p>The response still comes back as a list.</p>
  
  <pre><code>[
    {
       ...
       ...
     }
  ]
  </code></pre>
  
  <p>Now I know that Detailview is inheiriting from ListAPIView which it would make sense that it would come back as a List. But what am I supposed to do here? Override the serializer method to represent it as json or something? Thanks for your help in advance this has been a tough one</p>
  
  <p>The desired output would be something like</p>
  
  <p>{
   ... 
   ... # Various nested objects </p>
  
  <p>}</p>
  
  <p>The data comes out exactly the way I want with the exception of the the surrounding [] for the detail view. If I rewrite the method and do something like </p>
  
  <pre><code>return Response(serializer.data[0]) 
  </code></pre>
  
  <p>This works out perfectly. But seems kind of hacky</p>
  
  <p>Here are my serializers</p>
  
  <pre><code>class AutomationTemplateParameterSerializer(serializers.ModelSerializer):
  
      class Meta:
          model = AutomationTemplateParameter
          fields = ['sys_automation_template_parameter_id', 'sys_automation_template_id', 'parameter_name',
                'parameter_value', 'default_value', 'description', 'display_name']
  
  
  class AutomationTemplateSerializer(serializers.ModelSerializer):
  
      template_parameters = AutomationTemplateParameterSerializer(many=True)
  
      class Meta:
          model = AutomationTemplate
          fields = ['sys_automation_template_id', 'template_name', 'template_code',
                'template_code', 'display_name', 'description', 'template_parameters']
  
  
  class AutomationProcedureSerializer(serializers.ModelSerializer):
  
      procedure_template = AutomationTemplateSerializer(many=True)
  
      class Meta:
      model = AutomationProcedure
      fields = ['sys_automation_procedure_id', 'sys_application_service_id', 'procedure_code', 'description', 'display_name', 'command_line_args',
                'procedure_template']
      lookup_field = 'display_name'
  
      def to_representation(self, instance):
          procedures = super(AutomationProcedureSerializer, self).to_representation(instance)
          return {'procedures': procedures}
  </code></pre>
  
  <p>EDIT:</p>
  
  <p>I've updated the method to use a RetrieveApiView generics. I don't seem to be getting the attribute errors I was before but now the regex doesn't seem to be working</p>
  
  <pre><code>class ProcedureDetail(generics.RetrieveAPIView):
      queryset = AutomationProcedure
      serializer_class = AutomationProcedureSerializer
      lookup_field = ('display_name')
  </code></pre>
  
  <p>urls</p>
  
  <pre><code>url(r'^(?P&lt;display_name&gt;[a-zA-Z]+(?i))$', views.ProcedureDetail.as_view()),
  </code></pre>
  
  <p>api response</p>
  
  <pre><code>http --json GET http://localhost:8000/api/procedures/ display_name="Jenkins"
  
  
   Not Found: /api/procedures/
  [24/Jul/2018 15:37:59] "GET /api/procedures/ HTTP/1.1" 404 2640
  </code></pre>