[Django]-Adding context to django admin changelist_view

4👍

For anyone interested I resolved using a template tag instead

@register.filter
def get_lead_summary(qs):
    return qs.values('type_of_lead', 'may_contact_provider', 'type_of_care_care_home', 'type_of_care_home_care', 
                'type_of_care_live_in_care', 'type_of_care_retirement_village') \
            .order_by('type_of_lead', 'type_of_care_care_home', 'type_of_care_home_care', 
                'type_of_care_live_in_care', 'type_of_care_retirement_village','may_contact_provider') \
            .annotate(count=Count('type_of_lead'))

This is called with, for example, {% for row in cl.result_list|get_lead_summary %}

👤HenryM

Leave a comment