Skip to content

Commit

Permalink
Show contact proxy fields on the group pages
Browse files Browse the repository at this point in the history
  • Loading branch information
norkans7 committed Oct 30, 2024
1 parent 04b3578 commit 49d3751
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
3 changes: 3 additions & 0 deletions temba/contacts/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
6 changes: 5 additions & 1 deletion temba/contacts/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 49d3751

Please sign in to comment.