1. Documentation
  2. Filters
  3. Datetime filter

Datetime filters

Unfold offers two powerful datetime filtering options: the RangeDateFilter for date-only fields and the RangeDateTimeFilter for datetime fields. These filters are both implemented within the unfold.contrib.filters application, so you'll need to ensure this application is included in your project's INSTALLED_APPS configuration within settings.py for proper functionality.

Datetime filter

# admin.py

from django.contrib import admin
from django.contrib.auth.models import User

from unfold.admin import ModelAdmin
from unfold.contrib.filters.admin import RangeDateFilter, RangeDateTimeFilter


@admin.register(User)
class YourModelAdmin(ModelAdmin):
    list_filter_submit = True  # Submit button at the bottom of the filter
    list_filter = (
        ("field_E", RangeDateFilter),  # Date filter
        ("field_F", RangeDateTimeFilter),  # Datetime filter
    )

© 2023 - 2025 Created by unfoldadmin.com. All rights reserved.