I have a simple MultiValueField and MultiWidget (that I modified from this example http://groups.google.com/group/django-users/browse_thread/thread/9b64e524dcf9d279/1e1144d1d7d69bb9).
from django import newforms as forms class ContactWidget(forms.MultiWidget): def __init__(self,attrs=None,contact_types=()): widgets = (forms.Select(attrs=attrs,choices=contact_types),forms.TextInput(attrs=attrs)) super(ContactWidget,self).__init__(widgets,attrs) def decompress(self,value): if value: return value.split('__') return ['',''] class ContactField(forms.MultiValueField): def __init__(self,contact_types=(),required=True,label=None,initial=None): fields = (forms.ChoiceField(),forms.CharField(max_length=35)) widget = ContactWidget(contact_types=contact_types) super(ContactField,self).__init__(fields,required,widget,label,initial) def compress(self,data_list): if data_list: return '__'.join(data_list) return None contact_choices = ['Office Phone','Home Phone','Cell Phone','Fax','Pager'] contact_pairs = [(c,c) for c in contact_choices] class ContactForm(forms.Form): custom_field = ContactField(label='',contact_types=contact_pairs,required=False) But when I use ContactForm to validate some data the decompress method of ContactWidget doesn't get called, neither does commenting out ContactWidget's decompress method raise the NotImplementedError in / usr/lib/python2.4/site-packages/django/newforms/widgets.MultiWidget as I would expect. >>> d = {'custom_field':'Office Phone__1234567890','submit':'submit'} >>> cf = ContactForm(d) >>> cf.is_valid() True >>> cf.clean_data {'custom_field': u'__'} What have I done wrong? Justin --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---