Reputation: 10765
I'm trying to order a queryset and then filter the ordered set. Should this work? Or is it required that the order_by is the last operation in the chain?
for example
qs.order_by(books_count).filter(author="bob")
is this the same as?
qs.filter(author="bob").order_by(books_count)
I'm not getting the same results between the two.
Upvotes: 2
Views: 661
Reputation: 10765
Note - as per the comments above, the order in which you apply filters (filter, order_by) does not matter.
Upvotes: 1