#2443: Add IntervalField to database models
-------------------------------------------------------------+--------------
Reporter: [EMAIL PROTECTED] |
Owner: Gulopine
Status: new |
Component: Database wrapper
Version: SVN |
Resolution:
Keywords: IntervalField interval duration DurationField |
Stage: Design decision needed
Has_patch: 1 |
Needs_docs: 0
Needs_tests: 1 |
Needs_better_patch: 1
-------------------------------------------------------------+--------------
Comment (by stefanfoulis):
I've had some cases (mainly in the admin-interface) where
''get_db_prep_save(self, value)'' gets called with a value of type
''Decimal''. I don't know why that happens, but I added this code to fix
DurationField in these circumstances:
{{{
def get_db_prep_save(self, value):
if value is None:
return None
if (type(value) == decimal.Decimal) or (type(value)==float):
return str(value)
return str(value.days * 24 * 3600 + value.seconds +
float(value.microseconds) / 1000000)
}}}
If this is the correct way to fix this, please add it to the next diff you
make.
--
Ticket URL: <http://code.djangoproject.com/ticket/2443#comment:11>
Django Code <http://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 post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/django-updates?hl=en
-~----------~----~----~----~------~----~------~--~---