From 49d3751d90eb1c8c379a75b9ffd2bbc0e0fb3307 Mon Sep 17 00:00:00 2001 From: Norbert Kwizera Date: Wed, 30 Oct 2024 10:53:00 +0200 Subject: [PATCH] Show contact proxy fields on the group pages --- temba/contacts/tests.py | 3 +++ temba/contacts/views.py | 6 +++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/temba/contacts/tests.py b/temba/contacts/tests.py index 65a629d676..32f7e0fc83 100644 --- a/temba/contacts/tests.py +++ b/temba/contacts/tests.py @@ -426,6 +426,9 @@ def test_group(self, mr_mocks): self.assertEqual([frank, joe], list(response.context["object_list"])) self.assertEqual(["block", "unlabel", "send", "start-flow"], list(response.context["actions"])) + self.assertEqual( + [f.name for f in response.context["contact_fields"]], ["Home", "Age", "Last Seen On", "Created On"] + ) self.assertContentMenu( group1_url, diff --git a/temba/contacts/views.py b/temba/contacts/views.py index 8f358f0708..77f374f027 100644 --- a/temba/contacts/views.py +++ b/temba/contacts/views.py @@ -632,7 +632,11 @@ def get_context_data(self, *args, **kwargs): org = self.request.org context["current_group"] = self.group - context["contact_fields"] = ContactField.get_fields(org).order_by("-priority", "id") + + fields = ContactField.get_fields(org).order_by("-priority", "id") + proxy_fields = org.fields.filter(key__in=("last_seen_on", "created_on"), is_proxy=True).order_by("-key") + context["contact_fields"] = list(fields) + list(proxy_fields) + return context @classmethod