> You'll have to add another loop for the hours if you want more than just 
> 12:xx.

Actually, after I hit send, I was sort of curious about how to handle
the hours if you cross over from a.m. to p.m., but you just have add
another range to the comprehension, and use 24-hour format in the hour
range, making sure the second param in the hour range is one higher
than the last hour you want (so 14 if the last hour you want is 13:00,
i.e., 1:00pm):

TIME_CHOICES = ( (datetime.time(hour, min), datetime.time(hour,
min).strftime('%I:%M %p')) for hour in range(11,14) for min in
range(0, 60, 15) )

((datetime.time(11, 0), '11:00 AM'), (datetime.time(11, 15), '11:15
AM'), (datetime.time(11, 30), '11:30 AM'), (datetime.time(11, 45),
'11:45 AM'), (datetime.time(12, 0), '12:00 PM'), (datetime.time(12,
15), '12:15 PM'), (datetime.time(12, 30), '12:30 PM'),
(datetime.time(12, 45), '12:45 PM'), (datetime.time(13, 0), '01:00
PM'), (datetime.time(13, 15), '01:15 PM'), (datetime.time(13, 30),
'01:30 PM'), (datetime.time(13, 45), '01:45 PM'))

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to