django-admin-numeric-filter
django-admin-numeric-filter provides you several filter classes for Django admin which you can use to filter results in change list. It works in list_filter when a field name is defined as list where the first value is field name and second one is custom filter class (you can find classes below).
Don't forget to inherit your model admin from admin_actions.admin.NumericFilterModelAdmin to load custom CSS styles and JavaScript files declared in inner Media class.
Getting started
- Installation
pip install django-admin-numeric-filter
- Add admin_numeric_filter into INSTALLED_APPS in your settings file before django.contrib.admin.
Sample admin configuration
from admin_numeric_filter.admin import NumericFilterModelAdmin, SingleNumericFilter, RangeNumericFilter, \
SliderNumericFilter
from .models import YourModel
class CustomSliderNumericFilter(SliderNumericFilter):
MAX_DECIMALS = 2
STEP = 10
@admin.register(YourModel)
class YourModelAdmin(NumericFilterModelAdmin):
list_filter = (
('field_A', SingleNumericFilter), # Single field search, __gte lookup
('field_B', RangeNumericFilter), # Range search, __gte and __lte lookup
('field_C', SliderNumericFilter), # Same as range above but with slider
('field_D', CustomSliderNumericFilter), # Filter with custom attributes
)
Filter classes
| Class name | Description |
|---|---|
| admin_actions.admin.SingleNumericFilter | Single field search, __gte lookup |
| admin_actions.admin.RangeNumericFilter | Range search, __gte and __lte lookup |
| admin_actions.admin.SliderNumericFilter | Same as range above but with slider |
Slider default options for certain field types
| Django model field | Step | Decimal places |
|---|---|---|
| django.db.models.fields.DecimalField() | Based on decimal places | max precision from DB |
| django.db.models.fields.FloatField() | Based on decimal places | field decimal_places attr |
| django.db.models.fields.IntegerField() | 1 | 0 |
Metadata
Release files for django-admin-numeric-filter 0.1.9
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| django_admin_numeric_filter-0.1.9.tar.gz | 16.9 kB | Without provenance | Details for django_admin_numeric_filter-0.1.9.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| django_admin_numeric_filter-0.1.9-py3-none-any.whl | Python 3 | none | any | Details for django_admin_numeric_filter-0.1.9-py3-none-any.whl |
Total release size: 36.1 kB
Release files / django_admin_numeric_filter-0.1.9.tar.gz
| Download URL | django_admin_numeric_filter-0.1.9.tar.gz |
|---|---|
| Size | 16.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
22985bee625a08f76671e88647bfec0e04f2363e747bf26fad03603d4e32f0f1
|
|
BLAKE2b-256 checksum How to use checksums |
78a25df496e41037ae557034c991e2555293fd8505783291fffbe7f1a2cf858f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.3.2 CPython/3.10.8 Darwin/22.2.0
|
Release files / django_admin_numeric_filter-0.1.9-py3-none-any.whl
| Download URL | django_admin_numeric_filter-0.1.9-py3-none-any.whl |
|---|---|
| Size | 19.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
54799a8529848703fb1b73970854210479317f97ec2475238d0ab4619c1e0430
|
|
BLAKE2b-256 checksum How to use checksums |
648156b150019a748cd70a2e419e3070ccf06ef8a26ae8d1e1d61eab9385861e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.3.2 CPython/3.10.8 Darwin/22.2.0
|
Security for django-admin-numeric-filter 0.1.9
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.