Fixed bug in [601]

git-svn-id: http://code.djangoproject.com/svn/django/trunk@604 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Adrian Holovaty 2005-09-02 17:59:43 +00:00
parent 4e2f910ff1
commit 5d7c8a0c4f
1 changed files with 4 additions and 2 deletions

View File

@ -309,7 +309,6 @@ class Options:
lookup_overrides={
'content_type__package__label__exact': self.app_label,
'content_type__python_module_name__exact': self.module_name,
'object_id__id__exact': None,
})
rel_objs.append((relatedlinks.RelatedLink._meta, link_field))
self._all_related_objects = rel_objs
@ -926,6 +925,9 @@ def method_set_many_to_many(rel_field, self, id_list):
# Handles related-object retrieval.
# Examples: Poll.get_choice(), Poll.get_choice_list(), Poll.get_choice_count()
def method_get_related(method_name, rel_mod, rel_field, self, **kwargs):
if self._meta.has_related_links and rel_mod.Klass._meta.module_name == 'relatedlinks':
kwargs['object_id__exact'] = getattr(self, rel_field.rel.field_name)
else:
kwargs['%s__%s__exact' % (rel_field.name, rel_field.rel.to.pk.name)] = getattr(self, rel_field.rel.field_name)
kwargs.update(rel_field.rel.lookup_overrides)
return getattr(rel_mod, method_name)(**kwargs)