#11013: filter persons only with profile_on_web true for public search

This commit is contained in:
PCoder 2022-09-29 07:40:52 +05:30
parent db54e3c3d7
commit 30f0743c41

View file

@ -213,10 +213,10 @@ class SearchView(View):
per_page = int(self.request.GET.get('per_page', 10)) per_page = int(self.request.GET.get('per_page', 10))
q = self.request.GET.get('q', '').strip() q = self.request.GET.get('q', '').strip()
if not q or len(q) < 3: if not q or len(q) < 3:
query_set = Person.objects.all() query_set = Person.objects.filter(profile_on_web=True).all()
else: else:
query = reduce(operator.or_, (Q(field_indexer__icontains=item) for item in q.split(" "))) query = reduce(operator.or_, (Q(field_indexer__icontains=item) for item in q.split(" ")))
query_set = Person.objects.filter(query) query_set = Person.objects.filter(query).filter(profile_on_web=True)
q_country = self.request.GET.get('country', '') q_country = self.request.GET.get('country', '')
q_range = self.request.GET.get('range', '') q_range = self.request.GET.get('range', '')