-
Notifications
You must be signed in to change notification settings - Fork 7
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
Problem with durationfield v2.0.3 #3
Comments
Thanks for the report. I can also replicate this using Django 1.8. It does work correctly in version 1.0.8 (which was never pushed to pypi), and is incorrect in 2.0 - so it's a regression. I suspect this could be related to the removal of SubfieldBase in commit 29f48ab. The docs at https://docs.djangoproject.com/en/1.8/howto/custom-model-fields/#converting-values-to-python-objects state:
But nothing was modified on the field to provide Commit 13a3a34 is also slightly worrying, as it claims 'some fixes' for things which aren't described / referenced / tested. |
@mattaustin could you open a PR with your fixes? |
Hi,
I just installed thecut-durationfield with pip, getting version 2.0.3.
The durationfield is a great idea since django doesn't support postgres
relative timedelta like 'mons' or 'year'. Thanks a lot for making this!
Unfortunately I have problems using the RelativeDeltaField, using a
model like documented on
https://pypi.python.org/pypi/thecut-durationfield/2.0.3:
If I do this, I get an Error:
TypeError: unsupported operand type(s) for +: 'datetime.datetime' and 'str'
The same happens if I call the obejcts save method:
AttributeError: 'str' object has no attribute 'days' [save_traceback.txt](https://github.com/thecut/thecut-durationfield/files/421942/save_traceback.txt)
see attached save_traceback.txt
Obviously the 'P7D' string is not converted to relativedelta.
When I do this:
The above code works, also the save method, but only until I fetch the
entry from the Database:
Here the string is not converted back to a relativedelta object.
Any support would be highly appreciated!
Best regards,
Juergen
The text was updated successfully, but these errors were encountered: