From e14ebdc2f5a43593f4fa71be1e35508dc1fbdafa Mon Sep 17 00:00:00 2001 From: zandercymatics <141044360+zandercymatics@users.noreply.github.com> Date: Thu, 14 Dec 2023 14:49:21 -0700 Subject: [PATCH] Test sorting --- src/registrar/admin.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/registrar/admin.py b/src/registrar/admin.py index def7c64b1..b06f50cbb 100644 --- a/src/registrar/admin.py +++ b/src/registrar/admin.py @@ -549,7 +549,7 @@ class DomainApplicationAdmin(ListHeaderAdmin): # Columns list_display = [ - "requested_domain", + "get_requested_domain", "status", "organization_type", "created_at", @@ -557,6 +557,14 @@ class DomainApplicationAdmin(ListHeaderAdmin): "investigator", ] + def get_requested_domain(self, obj): + return obj.requested_domain + get_requested_domain.admin_order_field = 'requested_domain__name' # Allows column order sorting + get_requested_domain.short_description = 'Requested Domain' # Sets column's header + + + ordering = ['requested_domain__name'] + # Filters list_filter = ("status", "organization_type", "investigator")