From d256198504db1b0609ecc83a67a9c66da1c105b8 Mon Sep 17 00:00:00 2001 From: thenav56 Date: Thu, 12 Jun 2025 10:47:54 +0545 Subject: [PATCH 1/2] fix(sql): fix typo in comment in initdb.sql --- mapswipe_workers/tests/integration/set_up_db.sql | 2 +- postgres/initdb.sql | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/mapswipe_workers/tests/integration/set_up_db.sql b/mapswipe_workers/tests/integration/set_up_db.sql index f954d3a8c..6a8d1edd5 100644 --- a/mapswipe_workers/tests/integration/set_up_db.sql +++ b/mapswipe_workers/tests/integration/set_up_db.sql @@ -30,7 +30,7 @@ CREATE TABLE IF NOT EXISTS groups ( required_count int, progress int, project_type_specifics json, - -- total_area & time_spent_max_allowed are maintaned and used by aggregated module + -- total_area & time_spent_max_allowed are maintained and used by aggregated module total_area float DEFAULT NULL, time_spent_max_allowed float DEFAULT NULL, PRIMARY KEY (project_id, group_id), diff --git a/postgres/initdb.sql b/postgres/initdb.sql index f954d3a8c..6a8d1edd5 100644 --- a/postgres/initdb.sql +++ b/postgres/initdb.sql @@ -30,7 +30,7 @@ CREATE TABLE IF NOT EXISTS groups ( required_count int, progress int, project_type_specifics json, - -- total_area & time_spent_max_allowed are maintaned and used by aggregated module + -- total_area & time_spent_max_allowed are maintained and used by aggregated module total_area float DEFAULT NULL, time_spent_max_allowed float DEFAULT NULL, PRIMARY KEY (project_id, group_id), From d4805a0dc84dab9ce199b1b007b7860e8c30950c Mon Sep 17 00:00:00 2001 From: thenav56 Date: Thu, 12 Jun 2025 10:49:24 +0545 Subject: [PATCH 2/2] feat(django): add support for unaccent search for usergroups --- django/apps/existing_database/filters.py | 2 +- mapswipe_workers/tests/integration/set_up_db.sql | 1 + postgres/initdb.sql | 1 + 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/django/apps/existing_database/filters.py b/django/apps/existing_database/filters.py index 096f2f5a1..98227d94b 100644 --- a/django/apps/existing_database/filters.py +++ b/django/apps/existing_database/filters.py @@ -38,7 +38,7 @@ class UserGroupFilter: def filter_search(self, queryset): if self.search: queryset = queryset.filter( - name__icontains=self.search, + name__unaccent__icontains=self.search, ) return queryset diff --git a/mapswipe_workers/tests/integration/set_up_db.sql b/mapswipe_workers/tests/integration/set_up_db.sql index 6a8d1edd5..b2b23f328 100644 --- a/mapswipe_workers/tests/integration/set_up_db.sql +++ b/mapswipe_workers/tests/integration/set_up_db.sql @@ -1,5 +1,6 @@ -- noinspection SqlNoDataSourceInspectionForFile CREATE EXTENSION IF NOT EXISTS postgis; +CREATE EXTENSION IF NOT EXISTS unaccent; CREATE TABLE IF NOT EXISTS projects ( created timestamp, diff --git a/postgres/initdb.sql b/postgres/initdb.sql index 6a8d1edd5..b2b23f328 100644 --- a/postgres/initdb.sql +++ b/postgres/initdb.sql @@ -1,5 +1,6 @@ -- noinspection SqlNoDataSourceInspectionForFile CREATE EXTENSION IF NOT EXISTS postgis; +CREATE EXTENSION IF NOT EXISTS unaccent; CREATE TABLE IF NOT EXISTS projects ( created timestamp,