mirror of
https://github.com/ae-utbm/sith.git
synced 2024-11-22 14:13:21 +00:00
pedagogy: fix search api when searching one letter (case sensitivity)
This commit is contained in:
parent
79243aece3
commit
30ccbdc32d
@ -616,6 +616,10 @@ class UVSearchTest(TestCase):
|
|||||||
response = self.client.get(reverse("pedagogy:guide"), {"search": "P"})
|
response = self.client.get(reverse("pedagogy:guide"), {"search": "P"})
|
||||||
self.assertContains(response, text="PA00")
|
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
|
# Search with UV manager
|
||||||
response = self.client.get(reverse("pedagogy:guide"), {"search": "HEYBERGER"})
|
response = self.client.get(reverse("pedagogy:guide"), {"search": "HEYBERGER"})
|
||||||
self.assertContains(response, text="PA00")
|
self.assertContains(response, text="PA00")
|
||||||
|
@ -194,7 +194,7 @@ class UVListView(CanViewMixin, CanCreateUVFunctionMixin, ListView):
|
|||||||
if len(search) == 1:
|
if len(search) == 1:
|
||||||
# It's a search with only one letter
|
# It's a search with only one letter
|
||||||
# Hastack doesn't work well 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:
|
try:
|
||||||
qs = (
|
qs = (
|
||||||
|
Loading…
Reference in New Issue
Block a user