From 60834894882dd47271a6f947d2de79cc66e9bd69 Mon Sep 17 00:00:00 2001 From: zandercymatics <141044360+zandercymatics@users.noreply.github.com> Date: Fri, 16 Feb 2024 10:27:54 -0700 Subject: [PATCH 1/4] Add autocompelte fields --- src/registrar/admin.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/registrar/admin.py b/src/registrar/admin.py index f1680c76a..67f93a376 100644 --- a/src/registrar/admin.py +++ b/src/registrar/admin.py @@ -758,6 +758,14 @@ class DomainInformationAdmin(ListHeaderAdmin): # to activate the edit/delete/view buttons filter_horizontal = ("other_contacts",) + autocomplete_fields = [ + "creator", + "domain_application", + "authorizing_official", + "domain", + "submitter", + ] + # Table ordering ordering = ["domain__name"] @@ -1129,6 +1137,13 @@ class DomainAdmin(ListHeaderAdmin): ), ) + autocomplete_fields = [ + "creator", + "domain_application", + "authorizing_official", + "submitter", + ] + # this ordering effects the ordering of results # in autocomplete_fields for domain ordering = ["name"] From d72a3fc7d035915a617c247106e73566c578ce23 Mon Sep 17 00:00:00 2001 From: zandercymatics <141044360+zandercymatics@users.noreply.github.com> Date: Fri, 16 Feb 2024 11:36:05 -0700 Subject: [PATCH 2/4] Update admin.py --- src/registrar/admin.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/registrar/admin.py b/src/registrar/admin.py index 67f93a376..abb9832bc 100644 --- a/src/registrar/admin.py +++ b/src/registrar/admin.py @@ -1138,10 +1138,10 @@ class DomainAdmin(ListHeaderAdmin): ) autocomplete_fields = [ - "creator", + "domain_information__creator", "domain_application", "authorizing_official", - "submitter", + "domain_information__submitter", ] # this ordering effects the ordering of results From 7b227a26bb8dc0a4297cd63c1bb7c19ea34e569b Mon Sep 17 00:00:00 2001 From: zandercymatics <141044360+zandercymatics@users.noreply.github.com> Date: Fri, 16 Feb 2024 11:48:40 -0700 Subject: [PATCH 3/4] Update admin.py --- src/registrar/admin.py | 7 ------- 1 file changed, 7 deletions(-) diff --git a/src/registrar/admin.py b/src/registrar/admin.py index abb9832bc..9da8fc855 100644 --- a/src/registrar/admin.py +++ b/src/registrar/admin.py @@ -1137,13 +1137,6 @@ class DomainAdmin(ListHeaderAdmin): ), ) - autocomplete_fields = [ - "domain_information__creator", - "domain_application", - "authorizing_official", - "domain_information__submitter", - ] - # this ordering effects the ordering of results # in autocomplete_fields for domain ordering = ["name"] From 2aeb34c9eb4f8dae0f4c6831e2572e04f10e7749 Mon Sep 17 00:00:00 2001 From: zandercymatics <141044360+zandercymatics@users.noreply.github.com> Date: Fri, 16 Feb 2024 11:58:22 -0700 Subject: [PATCH 4/4] Fix bug with autocomplete on domains --- src/registrar/admin.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/registrar/admin.py b/src/registrar/admin.py index 9da8fc855..36d6b4fd9 100644 --- a/src/registrar/admin.py +++ b/src/registrar/admin.py @@ -1088,6 +1088,14 @@ class DomainInformationInline(admin.StackedInline): # to activate the edit/delete/view buttons filter_horizontal = ("other_contacts",) + autocomplete_fields = [ + "creator", + "domain_application", + "authorizing_official", + "domain", + "submitter", + ] + def formfield_for_manytomany(self, db_field, request, **kwargs): """customize the behavior of formfields with manytomany relationships. the customized behavior includes sorting of objects in lists as well as customizing helper text"""