-
Hi, ### I cannot use DateTime type to filter(use widget=DateTimeInput) . the error was given that "Enter a valid date." but DateType I can do it (Use widget =DateInput). it works you can see in the figure below. Belows are my source code. you can see widget which I use both DateInput and DateTimeInput in start_datetime__gt
I try to use https://pypi.org/project/django-datetime-widget2/
So far, I can apply only DateInput widget as code above, this is the only widget that works for me
thank you |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
Maybe the best solution is to use Django DateTime accepted formats https://www.geeksforgeeks.org/datetimefield-django-forms/ |
Beta Was this translation helpful? Give feedback.
-
You can use 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 |
Beta Was this translation helpful? Give feedback.
You can use
DateTimeFilter
to filter using a DateTime string.For Example:
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 takeswidget
as a keyword argument.