lack of ordering the get_list() params
|Reported by:||maurycy||Owned by:||adrian|
|Has patch:||no||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||no|
The next ticket with only IRC discussion. Feel free to post the comment, before closing, jackob. :-)
08:16 < maurycypw> btw. one question. do kwargs support ordering params? let's say i'd like to write: SELECT * FROM table WHERE a = 'b' AND = c = 'd' with the exactly the same order 08:16 < maurycypw> is it possible? 08:16 < rmunn> I don't think so. kwargs just shove everything into a standard dict. 08:17 < maurycypw> if i understand correctly, get_list() based on kwargs with get_list(a__exact='b', c__default='d') would generate where in the random manner 08:17 < rmunn> You could do tricks with naming your params like _01__a__exact='b', _02__c__exact='d', but that's hideous. :-) 08:17 < maurycypw> ugh 08:17 < rmunn> Right -- standard dicts make no guarantees about what order their keys will be in. 08:17 < maurycypw> it's quite ineffective, because sometimes the order of where params could save the database time and short the query execution time 08:18 -!- paolo [~email@example.com] has joined #django 08:18 < rmunn> People have written classes that inherit from dict and guarantee key order, but I don't know of any way to make Python's kwargs use anything but the standard dict class. 08:18 < maurycypw> in other hand, currently it's impossible to create efficient complicated get_list() queries. 08:19 < maurycypw> what about you talking is a ugly hack, it should be bult-in and supported by django by default 08:19 < rmunn> Perhaps you could add a keyword parameter clause_order=['a__exact', 'b__exact'] 08:19 -!- rmunn [~firstname.lastname@example.org] has quit [Remote closed the connection] 08:20 < maurycypw> :) 08:20 < maurycypw> looks more reasonable. i'll fill the ticket.