Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

[1.0.X] Fixed #9994 -- Fixed admin filtering when to_field is used on…

… relations.

Thanks to jzylks for diagnosing this one.

Backport of r10139 from trunk.

git-svn-id: http://code.djangoproject.com/svn/django/branches/releases/1.0.X@10140 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit 50379f4c915958f25a9b1264af97d2ff38cdea3a 1 parent 2fba099
Malcolm Tredinnick malcolmt authored
Showing with 2 additions and 1 deletion.
  1. +2 −1  django/contrib/admin/filterspecs.py
3  django/contrib/admin/filterspecs.py
View
@@ -58,7 +58,8 @@ def __init__(self, f, request, params, model, model_admin):
self.lookup_title = f.rel.to._meta.verbose_name
else:
self.lookup_title = f.verbose_name
- self.lookup_kwarg = '%s__%s__exact' % (f.name, f.rel.to._meta.pk.name)
+ rel_name = f.rel.get_related_field().name
+ self.lookup_kwarg = '%s__%s__exact' % (f.name, rel_name)
self.lookup_val = request.GET.get(self.lookup_kwarg, None)
self.lookup_choices = f.get_choices(include_blank=False)
Please sign in to comment.
Something went wrong with that request. Please try again.