开发者

django ordering with greek characters

in my django application admin i have the names of my administrators listed and ordered by name. However the alphabetical ordering does not seem to work correctly. I am not sure if thats because of the greek characters.

Here's what happens:

  • Names starting with the character A

  • then a name starting with the character Z

  • B,Γ,Δ,Ε... etc (ordering continues nor开发者_Go百科mally)

here's my class: (striped down from models.py)

class Admin(models.Model):
    admin_name = models.CharField(unique = True, blank = False, null = False, max_length = 128, verbose_name = u'admin full name')

    def __unicode__(self):
        return self.admin_name
    class Meta:
        ordering = ('admin_name',)
        verbose_name = u'Admin Info'

any help is greatly appreciated


This has nothing to do with Django, but is the responsibility of your database engine. Databases have a setting called 'collation', which determines how characters are sorted. For instance, for MySQL you probably want the greek_general_ci collation.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜