You must translate the value you received in the POST request to the unicode value before you construct a form based on the POST/form content.
You can use the _CHOICES_FORMATION variable. # these strings are in utf-8 - use it in the Model definition _CHOICES_FORMATION = ( 'Administração', 'Design Gráfico', 'Jornalismo', 'Marketing', 'Outras', ) class MyChoice(object): def __init__(self,val,usecode='latin_1'): self.val = unicode(val,usecode) self.valstr = self.val.encode('ascii','ignore') def __str__(self): return self.valstr def __unicode__(self): return self.val # use these for the Django form _CHOICES_FORMATION_FORM = tuple( [MyChoice(s,'utf-8') for s in _CHOICES_FORMATION] ) in your post handler def post(self): # translate the value for 'formation' to the right unicode string s = self.request.POST['formation'] self.request.POST['formation'] = [unicode(i) for i in _CHOICES_FORMATION_FORM if str(i)==s][0] 2011/2/18 Robert Kluin <robert.kl...@gmail.com>: > Looks like on your model definition you've specified 'choices' for > formation, and 'Administrao' is not one of the choices. > > Robert > > On Thu, Feb 17, 2011 at 20:42, Josir <josi...@gmail.com> wrote: >> I'm back on my choice internationalization problem. >> >> The solution given by djdjadji worked partially. Now the form is >> displayed but when I try to post data, I got a validation form error: >> >> Property formation is u'Administrao'; must be one of (, , >> 'Jornalismo', 'Marketing', 'Marketing', 'Psicologia', 'Publicidade', >> 'Radialismo', 'Cinema', 'Outras') >> >> Is this a Django 0.96 form error ? Is this solved if I upgrade Django >> to 1.2 ? >> Or: does somebody have any tip ? >> >> Thanks in advance, >> Josir Gomes >> >> On 26 jan, 15:05, djidjadji <djidja...@gmail.com> wrote: >>> 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.