On 1/27/06, Robert Wittams <[EMAIL PROTECTED]> wrote: > > Russell Keith-Magee wrote: > > 2) I have a minor problem with the _set suffix: to me, _set implies > > uniqueness in the returned results, which will not exist unless > > .distinct()/distinct=True is used. > > Could you provide an example where you would actually end up with > duplicate results here? I'm having trouble thinking of how this would > actually occur. AFAICT, each child object will only show up once in the > results. If there is one, I agree that it would make sense to use > distinct by default.
Any query involving joins over a m2o or m2m relation; if there are multiple matches in the related table, there will be multiple rows with the fields from the primary table: e.g., daily_planet = Newspaper.objects.get_object(name='Daily Planet') daily_planet.reporter_set.filter(article_headline__startswith="Foo") will duplicate results for every reporter that has written more than one article with a headline starting with 'Foo'. > There was a huge long thread a while back in which other names were > discussed. Look it up in the archive if you like. Ok. I missed that discussion the first time around. I now agree that _set is the best of the bunch. Fixing distinct seems the better approach. Russ Magee %-)