Hello, I have a newform object which I prepopulate some fields :
form = MenuForm() tu = () for m in Menu.objects.all(): tu += ((m.id,m),) form.fields['parent_id'].choices = tu In the case of Menu.__str__ return a utf-8 string, the SelectWidget raise an UnicodeError. To make it work I have to make this changes : --- widgets.py (revision 5173) +++ widgets.py (working copy) @@ -168,7 +168,7 @@ for option_value, option_label in chain(self.choices, choices): option_value = smart_unicode(option_value) selected_html = (option_value == str_value) and u' selected="selected"' or '' - output.append(u'<option value="%s"%s>%s</option>' % (escape(option_value), selected_html, escape(smart_unicode(option_label)))) + output.append(u'<option value="%s"%s>%s</option>' % (escape(option_value), selected_html, escape(smart_unicode(option_label.__str__())))) output.append(u'</select>') return u'\n'.join(output) is it a bug or am i doing something in the wrong way ? Thomas Rabaix --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---