def get_queryset(self):
    queryset = ModelName.objects.all()
name = self.request.query_params.get('name', None)
if name:
    queryset = queryset.filter(Q(name__icontains=name) | Q(
        abbreviation__icontains=name)).all()
else:
    pass
Validation on query_params in Django Rest Framework