Skip to content Skip to sidebar Skip to footer

Aggregation With Django-eztables

I'm using django-eztables to do server-side processing of a datatable. It's been working fine so far, but now I'm trying to add a field to my table that contains the total number o

Solution 1:

I eventually realized that I could put in the annotation in when I was overriding the get_queryset, like so:

defget_queryset(self):
    qs = super(SomeObjectDataTableView, self).get_queryset()
    return qs.select_related().annotate(items_count=Count('items'))

Probably should have figured this out earlier...

Post a Comment for "Aggregation With Django-eztables"