Re: Can't query records with my custom list order.

2009-05-08 Thread K*K
Good idea, thank you! :-D On May 8, 6:10 pm, Tim Chase wrote: > > First define some list contain random values such as: > > foo_list = (3, 4, 5, 2) > > > Then use QuerySet to query the list in a table, but it returns objects > > will increase id value. > > foo = Foo.objects.filter(id__

Re: Can't query records with my custom list order.

2009-05-08 Thread Tim Chase
> First define some list contain random values such as: > foo_list = (3, 4, 5, 2) > > Then use QuerySet to query the list in a table, but it returns objects > will increase id value. > foo = Foo.objects.filter(id__in = foo_list) > > Actually result: print foo.values > [{'id': 2}

Can't query records with my custom list order.

2009-05-08 Thread Xuqing Kuang
First define some list contain random values such as: >>> foo_list = (3, 4, 5, 2) Then use QuerySet to query the list in a table, but it returns objects will increase id value. >>> foo = Foo.objects.filter(id__in = foo_list) Actually result: >>> print foo.values [{'id': 2}, {'id': 3}, {'id': 4