-
-
Notifications
You must be signed in to change notification settings - Fork 6.9k
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
Add DurationField
#2989
Add DurationField
#2989
Conversation
Refs #2481. |
|
||
A Duration representation. | ||
Corresponds to `django.db.models.fields.Duration` for Django>=1.8 | ||
otherwise to `django.db.models.fields.BigIntegerField`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The documentation for this needs to go into what the input/output representation is.
Also what internal value is used (a timedelta
, right?)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes it is a timedelta.
I will update the documentation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@tomchristie I tried to find a better place for the documentation but I couldn't find it.
Please, Can you explain in details what you expect ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would simply mention that the validated_data
for these fields will contain a timedelta
, and that the field is only available with Django versions >= 1.8
I realized something is missing for Backward compatibility. I need to transform the timedelta instance into microseconds in |
I pushed a new version converting |
@tomchristie - given the backported wall of code -for |
Sounds reasonable. |
ok, I'll remove backport of DurationField |
@ticosax thanks a lot and sorry for the extra work. |
A Duration representation. | ||
Corresponds to `django.db.models.fields.Duration` for Django>=1.8 | ||
otherwise to `django.db.models.fields.BigIntegerField`. | ||
The representation is a string following this format `'[DD] [HH:[MM:]]ss[.uuuuuu]'` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing a full stop at the end of this sentence. (Just after the final backtick)
I removed the backport of DurationField. |
Looks really nice now! |
@xordoquy I'm happy with this whenever you are. |
Brillant. Thanks a lot @ticosax !! |
That was fast ! thank you also. |
Field that map to
django.db.models.fields.DurationField
for Django>=1.8 otherwisewith
django.db.models.fields.BigIntegerField