Hi!

So during DUTH sprints i took on an issue that i created over 3 years 
ago: https://code.djangoproject.com/ticket/21181...

The actual fix or improvement for my case right now actually really simple: 

class Collate(Func):
    function ='COLLATE'
    template = '(%(expressions)s) COLLATE "%(function)s"'

And then using it like this:
        ordering = Collate(
            F('first_name'),
            function=collation)
        qs = qs.order_by(ordering.desc())

It was all actually given as answer 
here: 
http://stackoverflow.com/questions/18935712/queryset-sorting-specifying-column-collation-for-django-orm-query

Going over this and making it work for the other databases (other than 
postgres), i need some help, because i know next to nothing about sqlite3, 
mysql and oracle. This is where i could use little help.

To get additional collations working with postgresql i first need to 
 create actualy locale files in my own computer like this:


sudo locale-gen et_EE.UTF-8

sudo update-locale


And then run the command in my database:
CREATE COLLATION "et_EE" (LOCALE = "et_EE.utf8")

And then i can use this collate function which will give me correct syntax 
like:
SELECT ... FROM ... ORDER BY ... COLLATE "et_EE" DESC

So this is where i could use your help - can someone provide me information 
about. Perhaps some of you can, with the cost of few minutes, save me some 
experimenting and trial-n-error time, by answering these questions:
1) how to do all these steps in sqlite3 (if at all possible and if not then 
what should be fallback/error, using Collate with sqlite3)
2) how to do all these steps in mysql (if at all possible and if not then 
what should be fallback/error, using Collate with mysql)
3) how to do all these steps in oracle (if at all possible and if not then 
what should be fallback/error, using Collate with oracle)

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers  (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-developers+unsubscr...@googlegroups.com.
To post to this group, send email to django-developers@googlegroups.com.
Visit this group at https://groups.google.com/group/django-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/d4aec91e-3293-444e-aab5-f41cc97c59cd%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to