django-admin: Add extra row with totals

后端 未结 7 1874
盖世英雄少女心
盖世英雄少女心 2020-12-12 20:50

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

7条回答
  •  星月不相逢
    2020-12-12 21:33

    There is also the package "django-admin-changelist-stats" that can give summary statistics. I have successfully used it in a Django 1.6 project.

    IMO use c4urself's solution for fine-grained template customization, but if its only aggregates (sum/avg/min/max) of tables you are after then this solution is pretty good.

    From its website

    " This simple application provides stats and aggregation capabilities for the Django admin changelist view. It allows to display stats at the end of the changelist page in a easy way, just adding one option to the model admin object. "

    More information,including examples, at its bitbucket repository webpage https://bitbucket.org/frankban/django-admin-changelist-stats/src

提交回复
热议问题