Hi, Personally I would map the priority of every character in a dict and pass this to sorted:
dd = { "cha1": 1, "char2": 2, "char3": 3, "char4": 4, } result = sorted(mylist, key=lambda x:dd[x[0]]) Point being if the db query isnt too slow you could use python. cheers sam_w On Thu, Jan 6, 2011 at 7:10 AM, Seth Gordon <se...@ropine.com> wrote: > On 01/05/2011 07:57 AM, James Hancock wrote: >> I think it does the same thing, but I was talking about how you cant set >> 'ordering' under the Meta class in a model. >> http://docs.djangoproject.com/en/1.2/ref/models/options/#django.db.models.Options.ordering >> >> <http://docs.djangoproject.com/en/1.2/ref/models/options/#django.db.models.Options.ordering>If >> I set it to a field of Japanese characters, the ordering comes out wrong. At >> least not in the desired order. >> How can I set the data collation for just a few fields? And how can I know >> which of the Japanese to set it to? > > Does the “strcoll” function in Python’s standard “locale” module do the > right thing when a Japanese locale is set? If not, can you persuade the > PyICU package to do the right thing? > > If either of these works, then you could slurp your results into a > Python list and then sort the list using one of these methods. This > wouldn’t perform too well, of course, if you had thousands and thousands > of results and you wanted the database to peel off the top ten... but if > for some reason collation at the database level isn’t working, doing it > all at the Python level might be better than nothing. > > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To post to this group, send email to django-us...@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. > > -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@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.