django-eztables
django-eztables copied to clipboard
Search filter with datetime values
Not sure if I am missing something really simple but it seems that I get a 500 error if the model returns a datetime value for the table. See error below. Any help will be appreciated.
Incorrect datetime value: '%De%' for column 'post_time' at row 1
Hi!
Just in case of eliminating potential misunderstandings, please provide the relevant parts of your code.
I'm also experiencing this when using a MySQL database (5.6.12). It occurs due to a text query being done against a DATE field throwing the following warning at the database level:
Warning: Incorrect date value: '%test%' for column 'exercise_date' at row 1
Despite MySQL throwing this warning the query still executes correctly (see here for a bit more info: http://stackoverflow.com/questions/7038286/how-to-add-a-datetimefield-to-admin-changelists-search-fields), though if you have DEBUG=True, Django will treat it as an error.
If you set DEBUG=False, the query should work.
This has been reported as a bug: http://bugs.mysql.com/bug.php?id=38915 http://bugs.mysql.com/bug.php?id=53601
Finally, the relevant part of my model:
class Exercise(Model):
exercise_date = models.DateField(null=True, blank=True)
We actually fixed the bSearchable issue. The indexing is off in the current implantation.
See this commit in our branch.
commit ed487f8f44f684909c879ac8a032e4c1e8a686a4