mirror of https://github.com/django/django.git
Fixed #9994 -- Fixed admin filtering when to_field is used on relations.
Thanks to jzylks for diagnosing this one. git-svn-id: http://code.djangoproject.com/svn/django/trunk@10139 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
91ebe9acae
commit
37f25d4c0c
|
@ -58,7 +58,8 @@ class RelatedFilterSpec(FilterSpec):
|
|||
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)
|
||||
|
||||
|
|
Loading…
Reference in New Issue