Fixed #527 -- Changed method_get_related() to use rel.get_related_field() instead of rel.field_name

git-svn-id: http://code.djangoproject.com/svn/django/trunk@1319 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Adrian Holovaty 2005-11-21 00:05:18 +00:00
parent acdd24f526
commit de770472b1
1 changed files with 1 additions and 1 deletions

View File

@ -964,7 +964,7 @@ 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': 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) kwargs['object_id__exact'] = getattr(self, rel_field.rel.field_name)
else: else:
kwargs['%s__%s__exact' % (rel_field.name, rel_field.rel.to.pk.name)] = getattr(self, rel_field.rel.field_name) kwargs['%s__%s__exact' % (rel_field.name, rel_field.rel.to.pk.name)] = getattr(self, rel_field.rel.get_related_field().attname)
kwargs.update(rel_field.rel.lookup_overrides) kwargs.update(rel_field.rel.lookup_overrides)
return getattr(rel_mod, method_name)(**kwargs) return getattr(rel_mod, method_name)(**kwargs)