title: Search view/serializer - Django Rest Framework
body: <p>Is there a way to implement a search view in my DRF API? For example, I use the following code on my site to allow the user to enter keywords into a search bar and return results.</p>
  
  <pre><code>class SearchListView(ListView):
      model = User
      template_name = 'search/results.html'
  
      def get_context_data(self, *args, **kwargs):
          context = super(SearchListView, self).get_context_data(*args, **kwargs)
          context['query'] = self.request.GET.get('q')
          return context
  
      def get_queryset(self, *args, **kwargs):
          user_qs = super(SearchListView, self).get_queryset(*args, **kwargs)
          query = self.request.GET.get('q')
  
          if query:
              user_qs = self.model.objects.filter(
                  Q(username__icontains=query)
                  )
          return user_qs
  </code></pre>
  
  <p>Is there a way to do this in DRF to use for my API?</p>
  
  <p>Thank you in advance!</p>