Skip to main content

Django Admin Totals

Module to show totals in Django Admin List.

codecov Build Status

Installation

virtualenv .
source bin/activate
pip install admin-totals

Or

pip install git+https://github.com/douwevandermeij/admin-totals.git

Usage

In settings.py

INSTALLED_APPS = [
    'admin_totals',
]

In admin.py:

from admin_totals.admin import ModelAdminTotals
from django.contrib import admin
from django.db.models import Sum, Avg
from django.db.models.functions import Coalesce

@admin.register(MyModel)
class MyModelAdmin(ModelAdminTotals):
    list_display = ['col_a', 'col_b', 'col_c']
    list_totals = [('col_b', lambda field: Coalesce(Sum(field), 0)), ('col_c', Avg)]

Make sure to at least have the columns of list_totals in list_display.

Tests

python runtests.py

Contributing

Please make sure to run the following commands before pushing and making a PR:

pip install -r requirements/test-ci.txt
isort --recursive admin_totals tests
flake8

isort will sort the imports and flake8 will lint the code. Please fix any errors before committing. Also, make sure to write passing tests.

Metadata

Release files for admin-totals 1.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for admin-totals 1.0.1
File Size Uploaded Provenance
admin-totals-1.0.1.tar.gz 6.0 kB Without provenance Details

Built distributions (wheels)

Table of built distributions (wheels) for admin-totals 1.0.1
File Interpreter ABI Platform
admin_totals-1.0.1-py3-none-any.whl Python 3 none any Details
admin_totals-1.0.1-py2-none-any.whl Python 2 none any Details

Total release size: 56.2 kB

Release files / admin-totals-1.0.1.tar.gz

Download URL admin-totals-1.0.1.tar.gz
Size 6.0 kB
Tags Source
SHA-256 checksum
How to use checksums
ba46e0307d35f3e6b2d10db8f23bb593e8024d59a074946d5a292b8de98f2509
BLAKE2b-256 checksum
How to use checksums
5daa79adcb8ea873b690ba9f286d0c6439f832df381f00cab3c9a02ed141f4d8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.12.1 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.6.3 requests-toolbelt/0.8.0 tqdm/4.29.1 CPython/3.7.2

Release files / admin_totals-1.0.1-py3-none-any.whl

Download URL admin_totals-1.0.1-py3-none-any.whl
Size 25.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
59c190e478f8d31d10117f75d4ff0a4dc73db8975ef9d6438515ff326019638d
BLAKE2b-256 checksum
How to use checksums
1981baaa1a6801331472f3174fc3cd85104a0a1d0442f4aa4375d9ae7546634e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.12.1 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.6.3 requests-toolbelt/0.8.0 tqdm/4.29.1 CPython/3.7.2

Release files / admin_totals-1.0.1-py2-none-any.whl

Download URL admin_totals-1.0.1-py2-none-any.whl
Size 25.1 kB
Tags Python 2
SHA-256 checksum
How to use checksums
609017540245373afe78dca105760331a9c2aa6fbafca1b5b5f1d12c7e6b3895
BLAKE2b-256 checksum
How to use checksums
c9a0cbb80e9758c31d524e078f23ee8c7917e37759ab91ed96fabbca44c3ab2b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.12.1 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.6.3 requests-toolbelt/0.8.0 tqdm/4.29.1 CPython/3.7.2

Security for admin-totals 1.0.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

1.0.1 This release

3 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page