diff -rupN django/contrib/admin/filterspecs.py /usr/lib/python2.7/site-packages/django/contrib/admin/filterspecs.py
old
|
new
|
class RelatedFilterSpec(FilterSpec):
|
74 | 74 | self.lookup_title = other_model._meta.verbose_name |
75 | 75 | else: |
76 | 76 | self.lookup_title = f.verbose_name # use field name |
77 | | rel_name = other_model._meta.pk.name |
| 77 | rel_name = f.rel.get_related_field().name |
78 | 78 | self.lookup_kwarg = '%s__%s__exact' % (self.field_path, rel_name) |
79 | 79 | self.lookup_kwarg_isnull = '%s__isnull' % (self.field_path) |
80 | 80 | self.lookup_val = request.GET.get(self.lookup_kwarg, None) |
diff -rupN django/contrib/admin/options.py /usr/lib/python2.7/site-packages/django/contrib/admin/options.py
old
|
new
|
class BaseModelAdmin(object):
|
229 | 229 | for part in parts[:-1]: |
230 | 230 | field, _, _, _ = model._meta.get_field_by_name(part) |
231 | 231 | if hasattr(field, 'rel'): |
232 | | model = field.rel.to |
233 | | pk_attr_name = model._meta.pk.name |
| 232 | pk_attr_name = field.rel.get_related_field().name |
234 | 233 | elif isinstance(field, RelatedObject): |
235 | 234 | model = field.model |
236 | 235 | pk_attr_name = model._meta.pk.name |