Hi All,
I am pretty new to Django.
I want the name of my models to be displayed in Chinese, so i used verbose_name in my meta class of my model, codes below:
#this models.py file is encoded in unicode
class TS_zone(models.Model):
index = models.IntegerField()
zone_name = models.CharField(max_length=50);
zone_icon = models.ImageField(upload_to='zone_icon', null=True)
is_active = models.NullBooleanField(blank=True, null=True)
status = models.CharField(max_length=7,choices=SETTING_STATUS_CHOICES)
class Meta:
ordering = ('index',)
verbose_name = u'你好嗎?'
verbose_name_plural = u'你們都好嗎?'
def __unicode__(self):
return self.zone_name
However when i run manage.py syncdb, the following errors throws:
File "E:\pythonroot\myproject\..\myproject\myapp\models.py", line 19
SyntaxError: Non-ASCII character '\xe4' in file
E:\pythonroot\myproject\..\myproject\myapp\models.py on line 19, but no encoding declared; see http://www.python.org/peps/pep-0263.html for details
It seems that manage.py cannot process non-ascii character in my verbose_name. Anything i have done wrong?
Thank you.