Re: How to merge two queryset, and sort the result by date

2006-04-05 Thread limodou
On 4/6/06, akaihola <[EMAIL PROTECTED]> wrote: > > My guess is that there's no way to do it on the db level. You can > retrieve the results for both queries as lists and then merge: > results = list(queryset1.filter(criteria...)) + > list(queryset2.filter(criteria...)) > results.sort(lambda a, b:

Re: How to merge two queryset, and sort the result by date

2006-04-05 Thread akaihola
My guess is that there's no way to do it on the db level. You can retrieve the results for both queries as lists and then merge: results = list(queryset1.filter(criteria...)) + list(queryset2.filter(criteria...)) results.sort(lambda a, b: cmp(a.date, b.date)) --~--~-~--~~

How to merge two queryset, and sort the result by date

2006-04-05 Thread limodou
Say I have a digest and blog model, and I also need to search from them. And the results will come from two tables, and how to easily merge them, and sort the result by date? Or there is an alternative way to do such thing? -- I like python! My Blog: http://www.donews.net/limodou My Django Site: