|
|
@@ -168,6 +168,17 @@ class ContactGroupView(generic.ObjectView):
|
|
|
queryset = ContactGroup.objects.all()
|
|
|
|
|
|
def get_extra_context(self, request, instance):
|
|
|
+ child_groups = ContactGroup.objects.add_related_count(
|
|
|
+ ContactGroup.objects.all(),
|
|
|
+ Contact,
|
|
|
+ 'group',
|
|
|
+ 'contact_count',
|
|
|
+ cumulative=True
|
|
|
+ ).restrict(request.user, 'view').filter(
|
|
|
+ parent__in=instance.get_descendants(include_self=True)
|
|
|
+ )
|
|
|
+ child_groups_table = tables.ContactGroupTable(child_groups)
|
|
|
+
|
|
|
contacts = Contact.objects.restrict(request.user, 'view').filter(
|
|
|
group=instance
|
|
|
)
|
|
|
@@ -175,6 +186,7 @@ class ContactGroupView(generic.ObjectView):
|
|
|
paginate_table(contacts_table, request)
|
|
|
|
|
|
return {
|
|
|
+ 'child_groups_table': child_groups_table,
|
|
|
'contacts_table': contacts_table,
|
|
|
}
|
|
|
|