jeffhg58
unread,Oct 2, 2008, 4:40:18 PM10/2/08Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Django users
I have the following code for the splitdatetimewidget
class MySplitDateTimeWidget(MultiWidget):
"""
A Widget that splits datetime input into two <input type="text">
boxes.
"""
def __init__(self, attrs=None):
print 'in init'
attrs1 = {'class':"vDateField required", 'size':10}
attrs2 = {'class':"vTimeField required", 'size':10}
widgets = (TextInput(attrs=attrs1), TextInput(attrs=attrs2))
super(MySplitDateTimeWidget, self).__init__(widgets, attrs)
def decompress(self, value):
print 'in decompress'
if value:
return [value.date(), value.time()]
return [None, None]
But, it seems the decompress is not getting called because I get the
date time returned into 2 separate fields instead of 1.
Any help would be greatly appreciated.
Thanks,
Jeff