Thanks for the replies guys. select().as_list() did the job for me. Luckily I don't have belongs in the query.
On Mon, Sep 10, 2012 at 10:01 AM, Marek Mollin <[email protected]> wrote: > bear in mind if you have belongs in query(rdbms optimizes ids when using > belongs), you might have to sort manualy via python builtin sorted (which > can sort all iterables) > > W dniu niedziela, 9 września 2012 17:55:26 UTC+2 użytkownik Anthony > napisał: > >> Do you have to use .as_dict()? Instead, you could use .as_list(), and >> you'll get a list of dictionaries instead of a dictionary of dictionaries. >> The list will retain the order of the original select (presumably you could >> use "orderby" to have the database return the records in the order you >> want). >> >> Anthony >> >> On Sunday, September 9, 2012 10:42:32 AM UTC-4, dundee wrote: >>> >>> >>> Hi all, >>> >>> I have an ajax call to some values and I use the ...select().as_dict in >>> my controller so that I can return a dict to process the results in my view. >>> Now I realize that I need these values to be sorted. As a dict >>> (..select().as_dict) is not ordered, how can this be accomplished? >>> >>> Once I needed something like this but I used the Collections module and >>> the OrderedDict, but this is different. >>> >>> I need some opinions on the best approach for this. >>> >>> >>> Thanks. >>> >>> >>> Regards >>> >>> Kevin >>> >> -- > > > > -- Kevin Miller Acting Data Controller Department of Computing UWI, Mona Kingston 7 --

