pedagogy: rename query to search in search API

This commit is contained in:
Antoine Bartuccio 2019-06-19 01:53:02 +02:00
parent 502ae09523
commit 22c028af11
Signed by: klmp200
GPG Key ID: E7245548C53F904B

View File

@ -162,7 +162,7 @@ class UVListView(CanViewMixin, CanCreateUVFunctionMixin, ListView):
) )
def get_queryset(self): def get_queryset(self):
query = self.request.GET.get("query", None) search = self.request.GET.get("search", None)
additional_filters = {} additional_filters = {}
@ -178,14 +178,14 @@ class UVListView(CanViewMixin, CanCreateUVFunctionMixin, ListView):
else: else:
additional_filters["semester"] = semester additional_filters["semester"] = semester
if not query: if not search:
return super(UVListView, self).get_queryset().filter(**additional_filters) return super(UVListView, self).get_queryset().filter(**additional_filters)
try: try:
queryset = ( queryset = (
SearchQuerySet() SearchQuerySet()
.models(self.model) .models(self.model)
.autocomplete(auto=html.escape(query)) .autocomplete(auto=html.escape(search))
) )
except TypeError: except TypeError:
return self.model.objects.none() return self.model.objects.none()