diff --git a/pedagogy/tests.py b/pedagogy/tests.py index f32a7ef9..1e6f2c37 100644 --- a/pedagogy/tests.py +++ b/pedagogy/tests.py @@ -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") diff --git a/pedagogy/views.py b/pedagogy/views.py index 55e3fdb1..befeb3c8 100644 --- a/pedagogy/views.py +++ b/pedagogy/views.py @@ -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 = (