I\'m using the standard django admin module to display a list of rows. One of the columns is a numerical field. I\'d like to display an extra \'totals\' row that has most of
This thread is going on for a while, but I'm probably not the last one that is looking for such a feature. Therefore, I created a package that makes it easy to add totals.
Checkout https://github.com/douwevandermeij/admin-totals
Usage:
from admin_totals.admin import ModelAdminTotals
from django.contrib import admin
from django.db.models import Sum, Avg
@admin.register(MyModel)
class MyModelAdmin(ModelAdminTotals):
list_display = ['col_a', 'col_b', 'col_c']
list_totals = [('col_b', Sum), ('col_c', Avg)]
Feel free to fork it and improve it.