Commit 30ccbdc3 authored by Sli's avatar Sli

pedagogy: fix search api when searching one letter (case sensitivity)

parent 79243aec
Pipeline #1880 canceled with stage
......@@ -616,6 +616,10 @@ class UVSearchTest(TestCase):
response = self.client.get(reverse("pedagogy:guide"), {"search": "P"})
self.assertContains(response, text="PA00")
# Search with first letter of UV code in lowercase
response = self.client.get(reverse("pedagogy:guide"), {"search": "p"})
self.assertContains(response, text="PA00")
# Search with UV manager
response = self.client.get(reverse("pedagogy:guide"), {"search": "HEYBERGER"})
self.assertContains(response, text="PA00")
......
......@@ -194,7 +194,7 @@ class UVListView(CanViewMixin, CanCreateUVFunctionMixin, ListView):
if len(search) == 1:
# It's a search with only one letter
# Hastack doesn't work well with only one letter
return queryset.filter(code__startswith=search)
return queryset.filter(code__istartswith=search)
try:
qs = (
......
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