Hi everyone, Django TimeField is mapped to Python datetime.time. That doesn't fit my needs since I must deal with durations, which can exceed 24h, and datetime.time can't do that.
On the MySQL side, TimeField is mapped to the MySQL TIME column type, which is correct IMO: http://dev.mysql.com/doc/refman/5.0/en/time.html "TIME values may range from '-838:59:59' to '838:59:59'. The hours part may be so large because the TIME type can be used not only to represent a time of day (which must be less than 24 hours), but also elapsed time or a time interval between two events (which may be much greater than 24 hours, or even negative)." >From basic testing, SQLite also seems to get this right. I don't know about other database backends though. But what about mapping to datetime.timedelta instead of datetime.time? It seems that it can do the job, altough it lacks strftime(), etc... but that can be worked around. I understand that the datetime.time mapping is very intuitive and must stay here for BC. But, if I am to prepare a patch for that, how should I proceed? Create a new DurationField? Let TimeField accept an extra 'duration' or 'delta' option so that it uses timedelta instead of time? (I tend to prefer this last one) -- Olivier
-- You received this message because you are subscribed to the Google Groups "Django developers" group. To post to this group, send email to django-develop...@googlegroups.com. To unsubscribe from this group, send email to django-developers+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-developers?hl=en.