1

I would like to use the Django date picker widget for searching in the admin. Lets suppose I have a model with field date_created. In the admin, I would like to have a date picker for date_created with start and end ranges using which I can filter the results.

Fahim Ahmed
  • 397
  • 4
  • 16

1 Answers1

0

You could use the 'date_hierarchy' attribute:

@admin.register(Hero)
class HeroAdmin(admin.ModelAdmin)
    ...
    date_hierarchy = 'date_created'

https://docs.djangoproject.com/en/2.2/ref/contrib/admin/#modeladmin-options

Serg
  • 16
  • 2