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. > > -- 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.