DB API documentation stated that:
pk lookups also work across joins. In the polls example, these two
statements are equivalent:
choices.get_list(poll__id__exact=3)
choices.get_list(poll__pk=3)
which is incorrect. looking at meta/__init__.py (svn djago trunk),
if lookup_list[-1] == 'pk':
if opts.pk.rel:
lookup_list = lookup_list[:-1] + [opts.pk.name,
opts.pk.rel.field_name, 'exact']
else:
lookup_list = lookup_list[:-1] + [opts.pk.name, 'exact']
'pk' resolved to Choice's primary key name, instead of Poll's primary
key name. The sample above works since Choice and Poll incidentally has
the same pk name, which is not always the case if user define their own
field with primary_key=True. Anyway the codes above seems dodgy.
--
dsw