From fffca816967301cf73b08e1767ac7f3bb0253d3b Mon Sep 17 00:00:00 2001 From: Obada Haddad Date: Tue, 17 Dec 2024 11:05:03 +0100 Subject: [PATCH 1/4] Added search bar in Django Admin Users page for emails and username --- src/apps/profiles/admin.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/apps/profiles/admin.py b/src/apps/profiles/admin.py index 2d20ce2f6..76f56a618 100644 --- a/src/apps/profiles/admin.py +++ b/src/apps/profiles/admin.py @@ -7,7 +7,7 @@ class UserAdmin(admin.ModelAdmin): # The following two lines are needed for Django-su: change_form_template = "admin/auth/user/change_form.html" change_list_template = "admin/auth/user/change_list.html" - + search_fields = ['username','email'] admin.site.register(User, UserAdmin) admin.site.register(Organization) From 55abd1e534a1a92c2929b66d95ab1146e135a13d Mon Sep 17 00:00:00 2001 From: Obada Haddad Date: Tue, 17 Dec 2024 11:10:58 +0100 Subject: [PATCH 2/4] Flake8 fixes --- src/apps/profiles/admin.py | 1 + 1 file changed, 1 insertion(+) diff --git a/src/apps/profiles/admin.py b/src/apps/profiles/admin.py index 76f56a618..ec5180c20 100644 --- a/src/apps/profiles/admin.py +++ b/src/apps/profiles/admin.py @@ -9,6 +9,7 @@ class UserAdmin(admin.ModelAdmin): change_list_template = "admin/auth/user/change_list.html" search_fields = ['username','email'] + admin.site.register(User, UserAdmin) admin.site.register(Organization) admin.site.register(Membership) From b38dff6aec287383c6c4e2d065e78fe19ae08d6a Mon Sep 17 00:00:00 2001 From: Obada Haddad Date: Tue, 17 Dec 2024 11:15:19 +0100 Subject: [PATCH 3/4] Flake8 fixes v2 --- src/apps/profiles/admin.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/apps/profiles/admin.py b/src/apps/profiles/admin.py index ec5180c20..8c7f2c1d7 100644 --- a/src/apps/profiles/admin.py +++ b/src/apps/profiles/admin.py @@ -7,7 +7,8 @@ class UserAdmin(admin.ModelAdmin): # The following two lines are needed for Django-su: change_form_template = "admin/auth/user/change_form.html" change_list_template = "admin/auth/user/change_list.html" - search_fields = ['username','email'] + search_fields = ['username', 'email'] + admin.site.register(User, UserAdmin) From bf2249a7818a5a4c540dd6375a8c8452cc639b23 Mon Sep 17 00:00:00 2001 From: Obada Haddad Date: Tue, 17 Dec 2024 11:15:58 +0100 Subject: [PATCH 4/4] Flake8 fixes v3 --- src/apps/profiles/admin.py | 1 - 1 file changed, 1 deletion(-) diff --git a/src/apps/profiles/admin.py b/src/apps/profiles/admin.py index 8c7f2c1d7..7435b8c82 100644 --- a/src/apps/profiles/admin.py +++ b/src/apps/profiles/admin.py @@ -10,7 +10,6 @@ class UserAdmin(admin.ModelAdmin): search_fields = ['username', 'email'] - admin.site.register(User, UserAdmin) admin.site.register(Organization) admin.site.register(Membership)