def get_queryset(self):
        """
        Optionally restricts the returned devices
        by filtering against a `search` query parameter in the URL.
        """
        # retrieve all devices which are published and accessible to current user
        # and use joins to retrieve related fields
        queryset = super(DeviceList, self).get_queryset()#.select_related('layer', 'status', 'user')

        # retrieve value of querystring parameter "search"
        search = self.request.query_params.get('search', None)

        if search is not None:
            search_query = (
                Q(name__icontains=search) |
                Q(description__icontains=search)
            )
            # add instructions for search to queryset
            queryset = queryset.filter(search_query)

        return queryset
Optionally restricts the returned devices
        by filtering against a `search` query parameter in the URL.