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

DATETIME_REGEX does not match DateField fields #1188

Closed
gmuj opened this issue May 11, 2015 · 6 comments
Closed

DATETIME_REGEX does not match DateField fields #1188

gmuj opened this issue May 11, 2015 · 6 comments

Comments

@gmuj
Copy link

gmuj commented May 11, 2015

To reproduce this just use a ModelSearchIndex where the model has a field of type DateField.
You should get a similar error when you try to filter using SearchQuerySet:

SearchFieldError: Datetime provided to 'disappear_date' field doesn't appear to be a valid datetime string: '2013-01-03'

@ravigadila
Copy link

@acdha
Same here,
SearchFieldError: Date provided to 'date' field doesn't appear to be a valid date string: '2016-02-27'

Environment:

Python 2.7
Django 1.8
django-haystack 2.4.1

@gmuj
Copy link
Author

gmuj commented Feb 16, 2016

@ravigadila I created a patch for this see this snippet https://gist.github.com/mgaby25/d603cf828ec90899a160

acdha added a commit to acdha/django-haystack that referenced this issue Feb 16, 2016
Now the convert method will be called by default when string values are
received instead of the normal date/datetime values.

Closes django-haystack#1188
acdha added a commit to acdha/django-haystack that referenced this issue Feb 16, 2016
Now the convert method will be called by default when string values are
received instead of the normal date/datetime values.

Closes django-haystack#1188
@acdha acdha closed this as completed in c478285 Feb 16, 2016
@yeago
Copy link
Contributor

yeago commented May 11, 2016

in master i get errorDate provided to 'top_position_date' field doesn't appear to be a valid date string: '2016-04-09T00:30:13Z'

@saulshanabrook
Copy link

Yeah I am getting this as well:

SearchFieldError: Date provided to 'date_posted_search' field doesn't appear to be a valid date string: '2017-06-26T13:03:22.452Z'

@gmuj
Copy link
Author

gmuj commented Jun 27, 2017

@saulshanabrook Your string represents a datetime field, you should use a DateTimeField instead of DateField

@saulshanabrook
Copy link

@mgaby25 You are right, it works when I changed it. Thank you!

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

No branches or pull requests

5 participants