Can this be helpful to you
http://www.stereoplex.com/blog/python-unicode-and-unicodedecodeerror
On Jan 17, 10:53 pm, Josir wrote:
> Hi folks, I have the following code:
>
> _CHOICES_FORMATION = (
> 'Administração',
> 'Design Gráfico',
> 'Jornalismo',
> 'Marketing',
> 'Outras'
Thanks for replying Zeynel.
I've read this article before but I could not understand how can it
help me because it does not have any citation on Django or GA.
Usually, in pure Python/Django, I use the u' notation and forms and
templates understand that the string is unicode.
But on GA, it's not w
Thanks for replying dj.
But it didn't work.
When I use this code:
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# coding=utf-8
from google.appengine.ext import db
_CHOICES_FORMATION = (
unicode('Administração','latin_1'),
unicode('Design Gráfico','latin_1'),
unicode('Marketing','lati
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'
In the unicode() call you must specify the encoding used, to decode
the string to a unicode one. Or pass it a unicode string.
example unicode(s,'utf-8')
The Django code uses the default encoding string ascii.
Or make a list of objects with a __unicode__() method that returns the
unicode version o
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__(sel
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 wrote:
> I'm back on my choice internationalization problem.
>
> The solution given by djdjadji worked partially. Now the f
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',