Security News
Input Validation Vulnerabilities Dominate MITRE's 2024 CWE Top 25 List
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
django-daterangefilter
Advanced tools
Application adds three Django admin list filters: DateRangeFilter
, PastDateRangeFilter
and FutureDateRangeFilter
. These filters let user filter models by date range. PastDateRangeFilter
and FutureDateRangeFilter
add quick selection of predefined date ranges. Filters can be applied to any model date fields. Application supports default Django admin theme and Suit theme.
Install django-daterangefilter
using pip:
pip install django-daterangefilter
Add daterangefilter
to INSTALLED_APPS
. Example:
INSTALLED_APPS = (
...
'daterangefilter',
...
)
Application uses static files so do not forget to issue collectstatic
management command in production environment.
in admin.py:
from django.contrib import admin
from daterangefilter.filters import PastDateRangeFilter, FutureDateRangeFilter
@admin.register(Post)
class PostAdmin(admin.ModelAdmin):
list_filter = [
('created_at', PastDateRangeFilter), ('publish_at', FutureDateRangeFilter)
]
Predefined ranges can be completely redefined by overriding _past_ranges.html
and _future_ranges.html
templates.
Take into account that these templates are inserted in the middle of the javascript code and may contain nothing but ranges
definition. For more examples on using moment
library refer to library documentation.
Filter widget uses a great JavaScript date range picker component - Date Range Picker by Dan Grossman.
FAQs
Date range filter for Django admin
We found that django-daterangefilter demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.
Research
Security News
A threat actor's playbook for exploiting the npm ecosystem was exposed on the dark web, detailing how to build a blockchain-powered botnet.