Then you have to build a class with a __str__() and a __unicode__() method. The __unicode__() method should return the string that is displayed in the combobox and the __str__() returns the value that is put in the field of the form at the time of submit.
class MyChoice(object): def __init__(self,val): self.val = unicode(val,'latin_1') self.valstr = self.val.encode('ascii','ignore') def __str__(self): return self.valstr def __unicode__(self): return self.val _CHOICES_FORMATION = ( MyChoice('Administração'), MyChoice('Design Gráfico'), MyChoice('Jornalismo'), MyChoice('Marketing'), MyChoice('Outras'), ) 2011/1/26 Josir <josi...@gmail.com>: > I got an error: > > File "/home/josir/sist/google_appengine/google/appengine/ext/db/ > djangoforms.py", line 170, in get_form_field > choices.append((str(choice), unicode(choice))) > UnicodeEncodeError: 'ascii' codec can't encode characters in position > 10-13: ordinal not in range(128) > > What I understand is function get_form_field try to convert choice to > a python string str(choice), where choice is each item of > _CHOICES_FORMATION > > Any ideas on how to fix it ? > > Josir -- You received this message because you are subscribed to the Google Groups "Google App Engine" group. To post to this group, send email to google-appengine@googlegroups.com. To unsubscribe from this group, send email to google-appengine+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-appengine?hl=en.