相关疑难解决方法(0)

Django头痛与简单的非ascii字符串

我刚刚创建了以下模型:

class Categoria(models.Model):
    nombre=models.CharField(max_length=30)
    padre=models.ForeignKey('self', blank=True, null=True)

    def __unicode__(self):
        return self.nombre
Run Code Online (Sandbox Code Playgroud)

然后注册到管理界面和syncdb'd

如果我只添加纯ASCII字符,一切都OK.但如果我添加一个名为"á"的"类别"(说些什么),我会得到:

Environment:

Request Method: GET
Request URL: http://192.168.2.103:8000/administracion/locales/categoria/
Django Version: 1.1.1
Python Version: 2.6.4
Installed Applications:
['django.contrib.auth',
 'django.contrib.contenttypes',
 'django.contrib.sessions',
 'django.contrib.admin',
 'cruzandoelsuquiaDJ.locales']
Installed Middleware:
('django.middleware.common.CommonMiddleware',
 'django.contrib.sessions.middleware.SessionMiddleware',
 'django.contrib.auth.middleware.AuthenticationMiddleware')


Template error:
In template /usr/lib/pymodules/python2.6/django/contrib/admin/templates/admin/change_list.html, error at line 78
   Caught an exception while rendering: ('ascii', '\xc3\xa1', 0, 1, 'ordinal not in range(128)')
   68 :         {% endif %}


   69 :       {% endblock %}


   70 :       


   71 :       <form action="" method="post"{% if cl.formset.is_multipart %} …
Run Code Online (Sandbox Code Playgroud)

unicode django-admin

8
推荐指数
2
解决办法
9457
查看次数

标签 统计

django-admin ×1

unicode ×1