Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Search filter with datetime values #12

Open
jgirdner opened this issue Dec 27, 2013 · 3 comments
Open

Search filter with datetime values #12

jgirdner opened this issue Dec 27, 2013 · 3 comments

Comments

@jgirdner
Copy link

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

@thepapermen
Copy link

Hi!

Just in case of eliminating potential misunderstandings, please provide the relevant parts of your code.

@rowandh
Copy link

rowandh commented Feb 18, 2014

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)

@jgirdner
Copy link
Author

We actually fixed the bSearchable issue. The indexing is off in the current implantation.

See this commit in our branch.

commit ed487f8

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants