From ce8fc854b95941746d2c859ec7738a5ab1e3e95c Mon Sep 17 00:00:00 2001 From: Lisa Yu Date: Wed, 27 Sep 2023 20:19:22 +0200 Subject: [PATCH 1/2] made loan application search case-insensitive --- .gitignore | 1 + inventory/views/item_loan.py | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index 8bd4f593d..f8f4416f7 100644 --- a/.gitignore +++ b/.gitignore @@ -27,3 +27,4 @@ static/ *.mo *.html.py *.txt.py +pyenv/ \ No newline at end of file diff --git a/inventory/views/item_loan.py b/inventory/views/item_loan.py index 7be76b2c1..951e6a78d 100644 --- a/inventory/views/item_loan.py +++ b/inventory/views/item_loan.py @@ -44,7 +44,7 @@ def get_queryset(self): # Additionally filter by the name of the applicant if name_filter: - applications = applications.filter(contact_name__contains=name_filter) + applications = applications.filter(contact_name__icontains=name_filter) return applications.order_by("loan_to") @@ -156,7 +156,7 @@ def get_initial(self, *args, **kwargs): user = self.request.user if user and user.is_authenticated: initial_form = { - "contact_name": "{} {}".format(user.first_name, user.last_name), + "contact_name": "{} {}".format(user.first_name, user.last_name), #her "contact_email": user.email, } From c5268a3a23f0338bd6eadbe888234a94fe04b0a2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nj=C3=A5l=20Telst=C3=B8?= Date: Wed, 27 Sep 2023 20:55:50 +0200 Subject: [PATCH 2/2] Format fix --- inventory/views/item_loan.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/inventory/views/item_loan.py b/inventory/views/item_loan.py index 951e6a78d..69cc20592 100644 --- a/inventory/views/item_loan.py +++ b/inventory/views/item_loan.py @@ -156,7 +156,7 @@ def get_initial(self, *args, **kwargs): user = self.request.user if user and user.is_authenticated: initial_form = { - "contact_name": "{} {}".format(user.first_name, user.last_name), #her + "contact_name": "{} {}".format(user.first_name, user.last_name), # her "contact_email": user.email, }