On Feb 11, 1:38 pm, Karen Tracey <kmtra...@gmail.com> wrote:
> On Wed, Feb 11, 2009 at 8:22 AM, Joshua Russo <joshua.rupp...@gmail.com>wrote:
>
> > I'm developing an app and want to use Portuguese characters in the
> > verbose field names for my models. The tables were created fine but
> > when I tried to implement the admin pages I received a
> > DjangoUnicodeDecodeError when it hit the first non-ASCII character. Is
> > this just a bug with the admin page processing?
>
> What level of Django are you using?
>
> What's the traceback you get that goes with the error?
>
> What level of Python are you using?
>
> What does your model look like -- specifically does it have a __unicode__
> method that returns unicode?
>
> Karen

Ok, I'm still having issues.

I'm using Django 1.0.2-final and Python 2.5.4

The models.py starts with the proper encoding string of: # -*- coding:
utf-8 -*-

Here is the line from my models.py that it's tripping up on:
NumTeleMov  = models.CharField(u'Numero de telemóvel', max_length=20)

Here is the trace back:
Environment:

Request
Method: GET
Request URL: http://localhost:8000/admin/pesoa/pesoa/add/
Django Version: 1.0.2 final
Python Version: 2.5.4
Installed Applications:
['django.contrib.auth', 'django.contrib.contenttypes',
'django.contrib.sessions', 'django.contrib.sites',
'django.contrib.admin', 'pesoa', 'matriz']
Installed Middleware:
('django.middleware.common.CommonMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware')
Traceback:
File "c:\python25\Lib\site-packages\django\core\handlers\base.py" in
get_response 86. response = callback(request, *callback_args,
**callback_kwargs)
File "c:\python25\Lib\site-packages\django\contrib\admin\sites.py" in
root 157. return self.model_page(request, *url.split('/', 2))
File "c:\python25\Lib\site-packages\django\views\decorators\cache.py"
in _wrapped_view_func 44. response = view_func(request, *args,
**kwargs)
File "c:\python25\Lib\site-packages\django\contrib\admin\sites.py" in
model_page 176. return admin_obj(request, rest_of_url)
File "c:\python25\Lib\site-packages\django\contrib\admin\options.py"
in
__call__ 191. return self.add_view(request)
File "c:\python25\Lib\site-packages\django\db\transaction.py" in
_commit_on_success 238. res = func(*args, **kw)
File "c:\python25\Lib\site-packages\django\contrib\admin\options.py"
in
add_view 478. ModelForm = self.get_form(request)
File "c:\python25\Lib\site-packages\django\contrib\admin\options.py"
in
get_form 277. return modelform_factory(self.model, **defaults)
File "c:\python25\Lib\site-packages\django\forms\models.py" in
modelform_factory 335. 'formfield_callback': formfield_callback})
File "c:\python25\Lib\site-packages\django\forms\models.py" in __new__
195. opts.exclude, formfield_callback)
File "c:\python25\Lib\site-packages\django\forms\models.py" in
fields_for_model 162. formfield = formfield_callback(f)
File "c:\python25\Lib\site-packages\django\contrib\admin\options.py"
in
formfield_for_dbfield 106. return db_field.formfield(**kwargs)
File
"c:\python25\Lib\site-packages\django\db\models\fields\__init__.py" in
formfield 418. return super(CharField, self).formfield(**defaults)
File
"c:\python25\Lib\site-packages\django\db\models\fields\__init__.py" in
formfield 306. defaults = {'required': not self.blank, 'label':
capfirst(self.verbose_name), 'help_text': self.help_text}
File "c:\python25\Lib\site-packages\django\utils\functional.py" in
wrapper 251. return func(*args, **kwargs)
File "c:\python25\Lib\site-packages\django\utils\text.py" in
<lambda> 9. capfirst = lambda x: x and
force_unicode(x)[0].upper() + force_unicode(x)[1:]
File "c:\python25\Lib\site-packages\django\utils\encoding.py" in
force_unicode 70. raise DjangoUnicodeDecodeError(s, *e.args)
Exception Type: DjangoUnicodeDecodeError at /admin/pesoa/pesoa/add/
Exception Value: 'utf8' codec can't decode bytes in position 15-18:
invalid data. You passed in 'Numero de telem\xf3vel' (<type
'str'>)


--~--~---------~--~----~------------~-------~--~----~
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 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to