Commit aff99edc authored by John Red Medrano's avatar John Red Medrano

removed manual search on list of form

parent 1562d3d7
......@@ -75,12 +75,11 @@ class ChangeRequestFormsViewset(viewsets.ModelViewSet):
filterset_class = HeaderFilterSet
ordering_fields = '__all__'
search_fields = (
"form_code", "requested_to_template_id", "requested_by_user__name",
"form_code", "status", "requested_to_template_id", "requested_by_user__name",
"requested_by_user__code", "requested_by_department__name",
"requested_to_company__name", "requested_to_department__name",
"requested_to_user__name", "requested_to_template_name",
"requested_to_objective", "requested_to_priority", "description",
"status",
"requested_to_objective", "requested_to_priority", "description"
)
def list(self, request, *args, **kwargs):
......@@ -101,13 +100,13 @@ class ChangeRequestFormsViewset(viewsets.ModelViewSet):
request.query_params.get('form_type'),
)
if self.request.query_params.get('search'):
search_key = self.request.query_params.get('search')
# if self.request.query_params.get('search'):
# search_key = self.request.query_params.get('search')
self.queryset = self.queryset.filter(
Q(requested_to_template_name__icontains=search_key.lower()) |
Q(requested_to_template_id__icontains=search_key.lower())
)
# self.queryset = self.queryset.filter(
# Q(requested_to_template_name__icontains=search_key.lower()) |
# Q(requested_to_template_id__icontains=search_key.lower())
# )
self.queryset = self.queryset.order_by('-created')
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment