> Having read this again in light of your complaint in #6701, I should
> point out that it's not going to work like this if you're always
> filtering on Contract.

Not really a complaint in #6701 - you didn't say at first that you
were going to remove support for m2m order_by, so I was concerned that
in the future people would do m2m order_bys and then hit the issue
that .count() wouldn't match len(queryset). My apologies for the drift
into discussing the meaning of m2m order_by though - I just replied
there 'cos that's where you said up that you didn't think it made
sense for django to do m2m order_by.

> A queryset is going to return one object for each
> distinct object if you do the equivalent of Contract.objects.all(), not
> on per many-to-many result.

So the .distinct() method is going to become redundant in qf-rf
because it will effectively always be the case?

> So if you want to order by suppliers like this, you'll need to do a
> queryset based on suppliers and pull back their related contract objects
> and then you can order on suppliers however you like.

So in the future with qs-rf I won't even be able to achieve this using
on a query of contracts by using .extras() to join in the suppliers
table for the purposes of expanding/sorting the results?

Contract objects are the focus of the results I want, and it's a
queryset of these that I pass to the paginator. Constructing something
to pass to the paginator from the starting point of supplier objects
just seems horribly inefficient and requires a chunk of special case
code for that specific sort rather than the alternative of a tweak to
expand the initial result set. If django isn't going to have the
notion of ordering on an m2m field and .extras() can't be used to work
around this then I think I'll just subclass queryset instead to make
it do what I want.

Matt

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to