How can join two django querysets in one?

Posted by diegueus9 on Stack Overflow See other posts from Stack Overflow or by diegueus9
Published on 2010-05-27T22:18:10Z Indexed on 2010/05/27 22:21 UTC
Read the original article Hit count: 465

I need order a Queryset by date in desc order, but i need put in the end the objects at the end, I do this:

qs1 = Model.objects.exclude(date=None).order_by('-date')
qs2 = Model.objects.filter(date=None).order_by('-date')

and my list is:

l = list(qs1)+list(qs2)

There is a more efficiently way for this?

© Stack Overflow or respective owner

Related posts about django

Related posts about django-models