diff --git a/temba/contacts/views.py b/temba/contacts/views.py index a3f7a4de48..54bdee79d2 100644 --- a/temba/contacts/views.py +++ b/temba/contacts/views.py @@ -149,16 +149,10 @@ def get_queryset(self, **kwargs): def get_context_data(self, **kwargs): context = super().get_context_data(**kwargs) - org = self.request.org - - # resolve the paginated object list so we can initialize a cache of URNs - contacts = context["object_list"] - Contact.bulk_urn_cache_initialize(contacts) + # prefetch contact URNs + Contact.bulk_urn_cache_initialize(context["object_list"]) - context["contacts"] = contacts - context["has_contacts"] = contacts or org.get_contact_count() > 0 context["search_error"] = self.search_error - context["sort_direction"] = self.sort_direction context["sort_field"] = self.sort_field diff --git a/templates/contacts/contact_list.html b/templates/contacts/contact_list.html index b67e51fe35..d482f330cd 100644 --- a/templates/contacts/contact_list.html +++ b/templates/contacts/contact_list.html @@ -219,7 +219,7 @@ {% endif %} - {% for object in contacts %} + {% for object in object_list %}