I'm not sure why DurationField should be added to the core. It's  
really easy to subclass MultipleValueField and MultiWidget.

In any case, from looking at DurationField, it seems that the defaults  
for days, seconds, and microseconds are sane enough that you would  
probably be safe to subclass DurationField, and override format_output  
like so:

def format_output(self, rendered_widgets):
        return u'%s : %s' % tuple(rendered_widgets[1:2])

Then in your form, you would have to override the default widget for  
your DurationField to use your new widget class.


On Apr 29, 2008, at 7:24 AM, Bram Duvigneau wrote:

>
> Hello,
>
> I'm using the DurationField from
> http://gulopine.gamemusic.org/2007/nov/03/storing-passages-of-time/
>
> This is working fine, but the included widget shows text fields for
> days, hours, minutes, seconds and microseconds. I would like to have
> hours:minutes. The best solution seems to be that I just render two
> fields of the widget, I could copy the widget and modify this in code,
> but that doesn't seem nice to me. So, here's my question: how could I
> render specific widgets of a MultiWidget in my template?
>
> Bram
>
> >


--~--~---------~--~----~------------~-------~--~----~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to