Skip to content

Error show 'Enter a valid date' Can not filter with datetime type. #1393

Answered by saadmk11
technqvi asked this question in Q&A
Discussion options

You must be logged in to vote

You can use DateTimeFilter to filter using a DateTime string.

For Example:

start_datetime__gt = django_filters.DateTimeFilter(field_name='created_date')

Ref: https://django-filter.readthedocs.io/en/main/ref/filters.html#datetimefilter

The error provided on the issue was caused by widgets because the filter takes widget as a keyword argument.

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by carltongibson
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants
Converted from issue

This discussion was converted from issue #1328 on July 08, 2021 10:26.