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
can't compare offset-naive and offset-aware datetimes #283
Comments
@manelclos can you add failing tests? |
@bmihelac sure, will do. I'll look further into the issue too. |
Tests are ok for me. Also, I have latest code working on another installation. USE_TZ seems not to be the problem. It also works on PostgreSQL. It may have something to do with the previous, original values. Field defined as:
When exporting:
When importing:
|
Hi @bmihelac here is what I think we should do: If the import works ok, just go ahead, this happens for me in different installations, and is also backwards compatible. Then, if we get the TypeError exception, try to make the datetime timezone aware and compare again:
https://docs.djangoproject.com/en/dev/topics/i18n/timezones/#troubleshooting Then, I'll have only the microseconds problem, but that should be solved by adding a DateTime widget with the proper format, right? |
@manelclos what do you think about checking We would basically replace this line with:
|
@bmihelac Yes, makes more sense, though the impact is also bigger. I'll try the suggested change. Thanks! |
Unfortunately |
@bmihelac can you please review? |
I tried to import a json file that was just exported.
settings.py contains USE_TZ=True
Line number: 1 - can't compare offset-naive and offset-aware datetimes
Traceback (most recent call last):
File "/apps/local/lib/python2.7/site-packages/import_export/resources.py", line 361, in import_data
if self.skip_row(instance, original):
File "/apps/local/lib/python2.7/site-packages/import_export/resources.py", line 266, in skip_row
if field.get_value(instance) != field.get_value(original):
TypeError: can't compare offset-naive and offset-aware datetimes
Same with CSV
The text was updated successfully, but these errors were encountered: