How to set calender form in list_filter for datetime field in django admin?

28 Views Asked by At

models.py:

class XYZ(models.Model):
    title = models.CharField(max_length=256)
    start = models.DateTimeField()
    end = models.DateTimeField()

    def __str__(self):
        return self.title

admin.py:

class XYZAdmin(admin.ModelAdmin):
    list_filter = (start,)

admin.site.register(XYZ,XYZAdmin)   

and it's return

enter image description here

now I want to change this filter to a pop-up calender and select custom start datateime and filter them.

like this image:

enter image description here

1

There are 1 best solutions below

0
StefanoTrv On

You need a date picker; check out this other question for some possible alternatives.