title: Use one class based view for both List and Retrieve Rest API
body: <p>I currently have two different class based views for detailing a specific object and for listing all objects:</p>
  
  <pre><code>class StatusList(ListAPIView):
      permission_classes = (IsAuthenticated,)
      serializer_class = serializers.StatusSerializer
  
      def get_queryset(self):
          queryset = helperfunctions.getObjects(self.request.user, models.Status)
          return queryset
  
  
  class StatusDetail(RetrieveAPIView):
      permission_classes = (IsAuthenticated,)
      serializer_class = serializers.StatusSerializer
  
      def get_queryset(self):
          queryset = helperfunctions.getObjects(self.request.user, models.Status)
          return queryset
  </code></pre>
  
  <p>Note that helperfunctions.getObjects() simply returns the objects that share the same establishment with the user, so that they can't see statuses that they shouldn't.</p>
  
  <p>What I want to know is whether there's an option to use only one class based view for both StatusDetail and StatusList, which would automatically know that when it gets a pk in the get request it returns the appropriate object, and when it doesn't, it should return the whole list of objects.</p>
  
  <p>Thanks for any help :)</p>