Django TimeField Model without seconds

1,639 views
Skip to first unread message

Hellnar

unread,
Aug 6, 2009, 1:26:47 PM8/6/09
to Django users
Greetings, I am trying to implement a TimeField model which only
consists of HH:MM (ie 16:46) format, I know it is possible to format a
regular Python time object but I am lost about how to manage this with
Django.

Cheers

Streamweaver

unread,
Aug 6, 2009, 1:37:37 PM8/6/09
to Django users
I'm not really sure you can but I'm also not clear why this is a
problem. It would seem easy to just not use seconds and filter them
out in the template and views as needed. Is this practical for your
needs or is there a specific benefit you're seeking by filtering out
seconds from the field?

Hellnar

unread,
Aug 6, 2009, 1:47:07 PM8/6/09
to Django users
Hello,
I need this because it is a task specific requirement for my project
(a television broadcast flow management which only consists of HH:MM
format).I will let the user login via the admin panel and add these
broadcast flows includint those times thus each addition with
assigning HH:MM:00 would be royal pain :)
Cheers

Paulo Almeida

unread,
Aug 6, 2009, 1:57:24 PM8/6/09
to django...@googlegroups.com
Hi,

Streamweaver wasn't suggesting assigning 00 to every time, just hiding what you don't want to show using views or templates. For instance:

http://docs.djangoproject.com/en/dev/ref/templates/builtins/#time

- Paulo
Reply all
Reply to author
Forward
0 new messages