#32249: Increment of duration field not works properly
-------------------------------------+-------------------------------------
Reporter: azaitsev | Owner: nobody
Type: | Status: new
Uncategorized |
Component: Database | Version: 3.1
layer (models, ORM) |
Severity: Normal | Keywords: duration
Triage Stage: | Has patch: 0
Unreviewed |
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
-------------------------------------+-------------------------------------
I have a duration field in some model:
{{{
My(models.Model):
...
duration = models.DurationField(default=timedelta(seconds=0))
}}}
and I try to increment durations via F expression:
{{{
obj.duration = F('duration') + (now - some_other_datetime)
}}}
as a result, we have a value of the following format in the database:
0:18:30.233251 instead of a big integer one. So this makes that instance
of model completely unusable, any attempt of access raise an exception:
TypeError: unsupported type for timedelta microseconds component: str
--
Ticket URL: <https://code.djangoproject.com/ticket/32249>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/051.ef0fbe0da458faca5fdc8677c796c8e9%40djangoproject.com.