用DEF的,有现成的,而用CLASS的,就要作一下变通。
如下:
if self.request.GET: if self.request.GET.get('search_pk'): search_pk = self.request.GET.get('search_pk') return DeployVersion.objects.filter(Q(name__icontains=search_pk) | Q(jenkins_number__icontains=search_pk) | Q(code_number__icontains=search_pk) | Q(description__icontains=search_pk))