Time duration in django models

1,596 views
Skip to first unread message

Mohamed Ghoneim

unread,
Aug 9, 2011, 6:32:53 AM8/9/11
to django...@googlegroups.com
Hey guys,

I am just wondering if there is a time duration field in django models.

what I want to do is a field that takes a time duration in days, hours, mins, seconds and store it into the database.

--
Mohamed Sayed Ghoneim

Scott Gould

unread,
Aug 9, 2011, 8:20:53 AM8/9/11
to Django users
Nothing native. I'd store it in seconds, as an int, and let the model
convert to and from a timedelta. Looks like there's a snippet all
ready to go:

http://djangosnippets.org/snippets/1060/
Reply all
Reply to author
Forward
0 new messages